Re: When is g_object_ref needed ?

Thanks. But there are still some mysteries. For example, this sequence :

my_pixmap = gdk_pixmap_new(...) ;
my_gc = gdk_gc_new(my_pixmap) ;
g_object_unref(my_pixmap) ;
g_object_unref(my_gc) ;

seems to lead to an error. I was told that g_object_unref(my_pixmap) ; would unref my_gc too. And effectively, if I delete the g_object_unref(my_gc) ; everything works fine.

Are there some others examples of dependancies in GDK/GTK ? (colormaps, for example ?)

Tristan Van Berkom a écrit :

Frédéric Terraza wrote:


I must use g_object_unref to free a gdk or a gtk object. There are lots of deprecated functions that are now replaced by g_object_unref (such as g_pixmap_unref, gdk_gc_unref).

But must I use g_object_ref after the creation of a pixmap or a gc, since there used to be g_pixmap_ref and g_gc_ref functions ?

  they GdkPixmap & GdkGC are GObjects so they need to be unreffed.
(and the correct way to do this is to use g_object_unref).


__________ NOD32 1.1238 (20050930) Information __________

This message was checked by NOD32 antivirus system.

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