GNOME Bugzilla – Bug 90259
Disposing a canvas group should dispose all of its children
Last modified: 2005-05-19 13:40:17 UTC
Hi, It would be nice if disposing a canvas group caused the group's children to be destroyed as well. I'd be happy to work up a patch to implement this, if it is desired behavior. Thanks for the feedback. wingo.
I'm not sure if this is really what you want. It would be nicer if GnomeCanvasGroup just holds a reference to its children and does a g_object_unref() when it is disposed. This problem is kinda related to bug #99689 (canvas is destroyed before items).
There's more to it: when a canvas is destroyed, it calls g_object_unref(root). When a CanvasGroup is destroyed it calls gtk_object_destroy() on all its children. gtk_object_destroy() calls run_dispose() which will force the dispose callback to be called. We should use *or* g_object_unref() *or* gtk_object_destroy(). This behavior will cause problems. The behavior requested by wingo will most likely not break compatibility.
Created attachment 15529 [details] [review] Do a gtk_object_destroy() on the root canvas item (from gnome_canvas_destroy)
This patch does an explicit gtk_object_destroy() in the canvas' destructor. In addition the canvas item sets its pointer to canvas explicitly to NULL.
Someone please review the patch in here.
I don't think canvas is really maintained much at this point. Arjan, if you want to email federico directly, and are interested, he would probably be willing to make you co-maintainer or something.
Federico, could you comment on this patch please?
this patch should be applied. the canvas doesn't allow for proper take down of its object tree currently and this patch allowes for that. it also fixes stale canvas pointers which is something a user can't properly work around.
Commited to both branches. Thanks.