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 90259 - Disposing a canvas group should dispose all of its children
Disposing a canvas group should dispose all of its children
Status: RESOLVED FIXED
Product: libgnomecanvas
Classification: Deprecated
Component: core
CVS HEAD
Other All
: High enhancement
: ---
Assigned To: libgnomecanvas maintainers
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2002-08-08 20:00 UTC by Andy Wingo
Modified: 2005-05-19 13:40 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Do a gtk_object_destroy() on the root canvas item (from gnome_canvas_destroy) (1.59 KB, patch)
2003-04-07 11:17 UTC, Arjan J. Molenaar
none Details | Review

Description Andy Wingo 2002-08-08 20:00:40 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.
Comment 1 Arjan J. Molenaar 2003-04-07 07:22:00 UTC
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).
Comment 2 Arjan J. Molenaar 2003-04-07 10:35:42 UTC
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.
Comment 3 Arjan J. Molenaar 2003-04-07 11:17:03 UTC
Created attachment 15529 [details] [review]
Do a gtk_object_destroy() on the root canvas item (from gnome_canvas_destroy)
Comment 4 Arjan J. Molenaar 2003-04-07 11:19:19 UTC
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.
Comment 5 Kjartan Maraas 2004-01-20 13:06:28 UTC
Someone please review the patch in here.
Comment 6 Luis Villa 2004-02-14 05:03:55 UTC
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.
Comment 7 Kjartan Maraas 2004-03-29 10:20:30 UTC
Federico, could you comment on this patch please?
Comment 8 Tim Janik 2005-05-16 14:07:07 UTC
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.
Comment 9 Kjartan Maraas 2005-05-19 13:40:17 UTC
Commited to both branches. Thanks.