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 99689 - Crashes when the canvas is destroyed before canvas items can be destroyed
Crashes when the canvas is destroyed before canvas items can be destroyed
Status: RESOLVED FIXED
Product: libgnomecanvas
Classification: Deprecated
Component: core
2.0.x
Other All
: High critical
: ---
Assigned To: libgnomecanvas maintainers
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2002-11-27 08:56 UTC by Arjan J. Molenaar
Modified: 2005-05-19 13:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adds weak references to GnomeCanvasItem::parent and ::canvas (3.30 KB, patch)
2003-04-07 08:57 UTC, Arjan J. Molenaar
none Details | Review

Description Arjan J. Molenaar 2002-11-27 08:56:27 UTC
CanvasItems crash when they are disposed after the canvas itself is 
disposed. This behaviour has been observed when using the canvas through 
gnome-python (the python objects might hold a reference on the canvas 
item).

Analysis
--------
A canvas item holds a reference to its canvas. However, if the canvas is 
disposed and some other object holds a reference to the canvas item, the 
canvas item holds a reference to a invalid memory location.

Solution
--------
g_object_add_weak_pointer() should be used to set the canvas to NULL as 
soon as it is destroyed.
Comment 1 Arjan J. Molenaar 2003-04-07 08:57:34 UTC
Created attachment 15524 [details] [review]
Adds weak references to GnomeCanvasItem::parent and ::canvas
Comment 2 Arjan J. Molenaar 2003-04-07 10:35:46 UTC
I found out that GnomeCanvasGroup uses gtk_object_destroy() to destroy
the canvas items. It makes no sense to hold weak references while
stuff is destroyed... GnomeCanvas however, uses g_object_unref... This
is IMHO not correct.

See also bug #90259
Comment 3 Kjartan Maraas 2004-01-20 13:10:34 UTC
Adding keywords and upping pri. Please review.
Comment 4 Kjartan Maraas 2004-03-29 10:23:03 UTC
Please take a look at the patch in this report.
Comment 5 Tim Janik 2005-05-16 14:07:57 UTC
using weak pointers is overkill. the bug is will be fixed by applying the patch
from bug #90259.
Comment 6 Kjartan Maraas 2005-05-19 13:42:27 UTC
The patch mentioned above has been commited. Closing this.