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 659653 - Unconnect signals when closing worksheets and buffers
Unconnect signals when closing worksheets and buffers
Status: RESOLVED FIXED
Product: reinteract
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: reinteract-maint
reinteract-maint
Depends on:
Blocks:
 
 
Reported: 2011-09-21 01:47 UTC by Owen Taylor
Modified: 2011-09-28 10:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Unconnect signals when closing worksheets and buffers (14.69 KB, patch)
2011-09-21 01:47 UTC, Owen Taylor
none Details | Review

Description Owen Taylor 2011-09-21 01:47:21 UTC
Here's a patch that adds a "Destroyable" mixin and aggressively disconnects
signals at shutdown. To my knowledge it doesn't actually fix any memory
leaks (since PyGObject hooks into the Python cycle collector to trace
signals), but it:

 - Reduces greatly the amount of cyclic garbage that needs to be collected
 - Makes the output of gc.get_referrers() on a leaked object more understandable
 - May actually fix some other types of memory leaks that otherwise wouldn't 
   be traceable (I can't think of why this would be the case - if there's
   a cycle that isn't traceable, it's a cycle that isn't traceable no matter
   how much other stuff references it, but I seemed to be seeing this in
   practice.)

Filed for contemplation, since this could also be seen as complicated things
unnecessarily. (I also don't really like the do_destroy name I used for the
implementation of destructions, since GtkWidget.do_destroy() must not be
implemented since widget->destroy() is called at finalization time after the
proxy is finalized.)
Comment 1 Owen Taylor 2011-09-21 01:47:24 UTC
Created attachment 197121 [details] [review]
Unconnect signals when closing worksheets and buffers

Add a 'Destroyable' mixin that can be added to GObject derived
classes to add a destroy() method which disconnect signals.

Use this to disconnect signal connections on ShellBuffer and Worksheet
when closing an editor.

Inspired by a patch from Robert Schroll - see bug 659346.
Comment 2 Owen Taylor 2011-09-28 10:54:09 UTC
I pushed this by accident - I guess I'll leave it in for now.