Re: gtk-2 bug, inconsistency or simply misunderstanding on my side ?
- From: Owen Taylor <otaylor redhat com>
- To: Olivier Fourdan <fourdan xfce org>
- Cc: gtk-app-devel-list gnome org, xfce4-dev moongroup com
- Subject: Re: gtk-2 bug, inconsistency or simply misunderstanding on my side ?
- Date: Fri, 27 Sep 2002 09:08:16 -0400 (EDT)
Olivier Fourdan <fourdan xfce org> writes:
Hi Owen,
How are you removing it? What do you mean by "freed twice"?
Can you provide a small test case?
The container is removed with gtk_widget_destroy. By "freed twice", I
mean that the widget destroy routine "mywidget_destroy(GtkObject
*object)" is called twice, usually leading to a core dump.
The gtkdial widget, given as example in gtk+-2.0.x source tree should be
enough to see the problem, by adding a simple trace to
gtk_dial_destroy() every time it's called.
destroy() does not mean "free", and having destroy() called
multiple times _will_ happen in some cases in GTK+-2.0.
the finalize() method is called exactly once when the
object is being freed.
_destroy() means "break existing links between objects".
_finalize() means free.
See:
http://developer.gnome.org/dotplan/porting/ar01s11.html#type-changes
So, yes, the gtkdial example is buggy:
if (dial->adjustment)
g_object_unref (GTK_OBJECT (dial->adjustment));
Should be
if (dial->adjustment)
{
g_object_unref (GTK_OBJECT (dial->adjustment));
dial->adjustment = NULL;
}
[ Filed as http://bugzilla.gnome.org/show_bug.cgi?id=94361 ]
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]