Re: Emission hooks for parent-set signal.(cont.)

On Mon, 6 Oct 2008, Yu Feng wrote:

static void
gtk_window_destroy (GtkObject *object)
 GtkWindow *window = GTK_WINDOW (object);

 toplevel_list = g_slist_remove (toplevel_list, window);

 if (window->transient_parent)
   gtk_window_set_transient_for (window, NULL);

 /* frees the icons */
 gtk_window_set_icon_list (window, NULL);

 if (window->has_user_ref_count)
     window->has_user_ref_count = FALSE;
     g_object_unref (window);

 if (window->group)
   gtk_window_group_remove_window (window->group, window);

  gtk_window_free_key_hash (window);

  GTK_OBJECT_CLASS (gtk_window_parent_class)->destroy (object);

Maybe moving the ->destroy line to the beginning of this function can fix the problem?

Assuming you suggest moving ->destroy() to before
the g_object_unref() call because you see ref_count
assertions with your emission hook uses, the answer
is: No.
The only way this function can be validly called is
via a signal emission of the GtkObject::destroy signal.
And emitting a signal on an instance will ref the
instance before and unref the instance after
the emission.



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