Il giorno lun, 19/12/2011 alle 22.40 +1100, Tim Cuthbertson ha scritto: > I have an extension (http://gfxmonk.net/shellshape/) that connect()s > to a large number of GObject signals on various things (workspaces, > displays, windows, etc). > > Is it good form to dutifully track all these connections and > explicitly disconnect() them in my extension's disable() function? I > was hoping I could just let the objects go out of scope by `delete`ing > them, and that perhaps the signals would be released then. But it > seems like a long shot, does anyone know if that's sufficient? The best way is to manually disconnect all of them (To automate this, you can use an array of (object, signal_id), and just push when you connect, pop when you disconnect). If you are connecting many signals to few objects, you can force disconnection with .run_dispose() or anything that calls it (including destroy() from Clutter.Actor) - obviously this only affects GObject signals, not JS signals. Just deleting them will call dispose at GC time, which maybe an unspecified time in the future, during which signals can be emitted and make your application crash. Also, if you stored the object in a local variable in the outer scope of the connected function, it could be that the function holds a reference to it through the scope chain, making it an uncollectable cycle. Giovanni
Attachment:
signature.asc
Description: This is a digitally signed message part