After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 780426 - Casting delegates to owned parameters/variables leaks target-reference
Casting delegates to owned parameters/variables leaks target-reference
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Delegates
0.36.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2017-03-22 22:01 UTC by Rico Tzschichholz
Modified: 2017-06-22 14:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
codegen: Don't leak target-reference when casting/assigning owned delegates (3.63 KB, patch)
2017-03-22 22:19 UTC, Rico Tzschichholz
committed Details | Review

Description Rico Tzschichholz 2017-03-22 22:01:38 UTC
delegate void FooFunc ();

class Foo : Object {
	public Foo () {
		bar ((FooFunc) func);
	}

	public void func () {
	}

	void bar (owned FooFunc f) {
	}
}

void main () {
	var foo = new Foo ();
	FooFunc f = foo.func;
}


bar ((FooFunc) func);
>>>
foo_bar (self, (FooFunc) foo_func, g_object_ref (self), NULL);


FooFunc f = foo.func;
>>>
f = (FooFunc) foo_func;
f_target = g_object_ref (foo);
f_target_destroy_notify = NULL;


This is a regression of
commit 6d07669384cdb70c3c657dba67d5048212f25da9
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Thu Jul 11 22:39:53 2013 +0200

    codegen: Allow scope=async delegates to be used in vala code
    
    Fixes bug 703804
Comment 1 Rico Tzschichholz 2017-03-22 22:19:41 UTC
Created attachment 348544 [details] [review]
codegen: Don't leak target-reference when casting/assigning owned delegates

Regression of 6d07669384cdb70c3c657dba67d5048212f25da9
Comment 2 Rico Tzschichholz 2017-06-22 14:48:36 UTC
commit 74aa6d2ab5d8c0a787ac8d9003c50233d5765a6e
Author: Rico Tzschichholz <ricotz@ubuntu.com>
Date:   Wed Mar 22 19:16:06 2017 +0100

    codegen: Don't leak target-reference when casting/assigning owned delegates
    
    Regression of 6d07669384cdb70c3c657dba67d5048212f25da9