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 639873 - GBinding: Crash when binding two properties on the same instance
GBinding: Crash when binding two properties on the same instance
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
2.27.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-01-18 17:53 UTC by Matthew Barnes
Modified: 2012-03-05 15:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test program (1.87 KB, text/plain)
2011-01-18 17:54 UTC, Matthew Barnes
  Details
Proposed patch (1.09 KB, patch)
2011-01-18 18:03 UTC, Matthew Barnes
accepted-commit_now Details | Review
Fix binding properties of the same object (4.05 KB, patch)
2012-03-05 01:49 UTC, Matthias Clasen
committed Details | Review

Description Matthew Barnes 2011-01-18 17:53:34 UTC
Binding two properties on the same instance and then finalizing the instance causes GLib to crash in gbinding.c:weak_unbind().  I've attached a test program to demonstrate.

Silly as this case may seem, it can be useful when the binding has a transform function.
Comment 1 Matthew Barnes 2011-01-18 17:54:27 UTC
Created attachment 178642 [details]
Test program
Comment 2 Matthew Barnes 2011-01-18 18:03:49 UTC
Created attachment 178643 [details] [review]
Proposed patch

Slightly modified version of Emmanuele's initial patch, which avoids a runtime warning (no need to call g_signal_handler_disconnect() in the first hunk because both binding->source and binding->target are already finalized).
Comment 3 Matthew Barnes 2011-01-18 18:06:26 UTC
Actually, you don't really need the first hunk at all.  The existing logic in weak_unbind() will do the right thing.
Comment 4 Matthew Barnes 2011-03-15 18:26:22 UTC
*ping*
Comment 5 Emmanuele Bassi (:ebassi) 2012-03-04 22:46:46 UTC
looks good to me; sorry, it completely fell off my radar.
Comment 6 Matthias Clasen 2012-03-05 00:31:31 UTC
Review of attachment 178643 [details] [review]:

go for it
Comment 7 Matthias Clasen 2012-03-05 01:49:54 UTC
The following fix has been pushed:
1426a8c Fix binding properties of the same object
Comment 8 Matthias Clasen 2012-03-05 01:49:57 UTC
Created attachment 208974 [details] [review]
Fix binding properties of the same object

This problem was pointed out in bug 639873.
The patch here is based on Matt Barnes patch,
I've added a testcase as well.
Comment 9 Matthew Barnes 2012-03-05 15:11:11 UTC
Thanks for the quick response to my mailing list nag.  :)