Re: Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-31 Thread Brian . Lu
Hi, Markku, Thanks a lot for your help. I did some further investigation on this issue. I have two questions on this issue: 1. The object created by gtk_invisible_new() is not floating. Here is a snippet from gtk+-2.12.5/tests/testselection.c init_atoms(); selection_widget =

Re: Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-30 Thread markku . vire
Hi, Answers to your questions: 1) Yes, the GtkInvisible is *not* floating (see the my description earlier in this thread to find out why). Note that any toplevel widget (GtkWindow, GtkDialog) is *not floating* either, for the same reason. 2) Yes, you need to use gtk_widget_destroy in

Re: Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-30 Thread Sven Herzberg
Am Mittwoch, den 30.01.2008, 10:54 +0200 schrieb [EMAIL PROTECTED]: The floating references in GTK make the whole reference counting a bit messy. The following points make life easier: * Always have a matching g_object_unref for each g_object_ref you have You mean, g_object_ref_sink().

Re: Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-15 Thread Brian . Lu
Markku Vire wrote: Hi, The reference that is returned by gtk_invisible_new is not owned by the caller. If one tries to unref it, it's an immediate memory corruption. When a toplevel widget is concerned, the things go like the following: * New floating GtkWidget is created (not owned by

Re: Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-11 Thread Brian Lu
Thanks a lot for your explanation. But look at following snippet from firefox latest code base: void InitWidget() { mWidget = gtk_invisible_new(); gtk_object_ref(GTK_OBJECT(mWidget)); gtk_object_sink(GTK_OBJECT(mWidget)); gtk_widget_ensure_style(mWidget);

Re: Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-11 Thread Brian J. Tarricone
(This is a bit better suited to gtk-app-devel-list, but...) Brian Lu wrote: Thanks a lot for your explanation. But look at following snippet from firefox latest code base: void InitWidget() { mWidget = gtk_invisible_new(); gtk_object_ref(GTK_OBJECT(mWidget));

Re: Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-11 Thread Markku Vire
Hi, The reference that is returned by gtk_invisible_new is not owned by the caller. If one tries to unref it, it's an immediate memory corruption. When a toplevel widget is concerned, the things go like the following: * New floating GtkWidget is created (not owned by anyone). * GTK library

Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-10 Thread Brian Lu
Hi, experts, I found following codes will crash in gnome 2.21 environment: ... GtkWidget *foo = gtk_invisible_new(); gtk_widget_unref(foo); ... But it works well if gtk_widget_unref() is replaced with gtk_widget_destroy(). Does that mean that we can't use gtk_widget_unref() on such

Re: Can I use gtk_widget_unref() to releasetthe object created by gtk_invisible_new()?

2008-01-10 Thread Markku Vire
Hi, The caller doesn't own the returned reference in case of any gtk_*_new functions, but the results are floating references (they are removed once somebody calls gtk_object_sink). This is different from normal GObjects. So, unreffing the returned value causes practically a double free.