GNOME Bugzilla – Bug 659653
Unconnect signals when closing worksheets and buffers
Last modified: 2011-09-28 10:54:09 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.)
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.
I pushed this by accident - I guess I'll leave it in for now.