RE: How to delete object?!



-----Original Message-----
From: hp icon labs redhat com [mailto:hp icon labs redhat com]On Behalf Of
Havoc Pennington
Sent: Wednesday, January 24, 2001 6:46 PM
To: Dmitry Ponomaryov
Cc: gtk-app-devel-list gnome org
Subject: Re: How to delete object?!

"Dmitry Ponomaryov" <eagleowl comail ru> writes:
So I try this:
     while( !GTK_OBJECT_DESTROYED( GTK_OBJECT(pr_dialog) ) )
             gtk_object_unref( GTK_OBJECT(pr_dialog) );
or this:
     while ( pr_dialog != NULL )
             gtk_widget_unref( pr_dialog );

These are broken; the problem is that some code is holding a reference
to the widget. You need _that code_ to remove its reference, or you
will get crashes.
   Ok.

while (object_is_alive)
 unref (object);

is always, always, always broken code. You should know how many
references you own and remove that many.
  How can I get the number of references (or variable which holds it)?
  [I don't want to set it manualy to zero :-) I want it for debug purposes]

 So I need somethig like: g_print( "ref count now is: %d", dialog-> /* HOW
TO GET REF COUNT?*/  );
 [or may be I should use "gtk_trace_referencing( )"?]

---
 Dmitry Ponomaryov





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]