Re: [gtk-list] Re: object unref error



David Given wrote:

> the button, and your callback gets called. When you call gtk_widget_destroy(),
> the "destroy" signal fires. AFAIK gtk_widget_destroyed attempts to destroy the
> current widget. So you end up destroying it twice.
> 

> Try instead of the second gtk_signal_connect() this:
> 
>         gtk_signal_connect_object(
>                 GTK_OBJECT(okBtn),      // Object signal is attached to
>                 "clicked",              // Signal name
>                 GTK_SIGNAL_FUNC(gtk_widget_destroyed), // Callback
>                 GTK_OBJECT(dlg),        // Object actually passed to callback
>                 NULL);                  // User data
> 
> Of course, I could be entirely wrong. Feel free to correct me.


Thanks, but I have to tell ya' :-) gtk_sig*_object() only takes
4 parameters so the last NULL shouldn't be there. I tried this
in various combinations (allowing for typos) and didn't get it
to work, once I removed the NULL and ran it:

1) gtk_widget_destroy + dlg
   click OK button results in **Gdk-Message ERROR: sigseg caught

2) gtk_widget_destroyed + dlg

   click OK button, usually the dialog does *not* get destroyed.
   A Gtk-Warning "Invalid unclassed pointer in cast to GtkObject"
   followed in some ocassions by a sigsev.

3) popupCB + dlg (popupCB uses gtk_widget_destroy()

   press OK causes Gtk-CRITICAL gtkobject.c line 1164 gtk_object_unref
   assertion object != NULL failed. The dialog *does* disappear and
   the application runs without a sudden stroke.

So, any more suggestions anyone?
    

-- 
D. Emilio Grimaldo Tunon       Compuware Europe B.V. (Uniface Lab)
Software Engineer	       Amsterdam, The Netherlands
emilio_tunon@nl.compuware.com  Tel. +31 (0)20 3126 516
*** The opinions expressed hereby are mine and not my employer's ***



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