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 =
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
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().
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
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);
(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));
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
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
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.