Re: [gtk-list] object unref error



[...]
>yes, object is not null but what on earth does it mean? why does
>it occur in 1.1.5 and not in 1.0.5? The signal connection to the
>OK button is as follows:
>
>    dlg = gtk_dialog_new();
>    gtk_signal_connect(GTK_OBJECT(dlg), "destroy",
>	    	       GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dlg);
>: some code omitted for clarity
>   gtk_signal_connect(GTK_OBJECT(okBtn), "clicked",
>                       (GtkSignalFunc)popupCB, (gpointer)dlg);
>
>
>I don't know what gtk_widget_destroyed does by the way...
>
>and the callback is:
>
>  
>  static void popupCB(GtkWidget *widget, gpointer dlg)
>  {
>       gtk_widget_destroy((GtkWidget *)dlg);
>  }

>From my limited knowledge, what I'd expect was happening is this: you click 
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.


-- 
+- David Given ------------McQ-+ 
|  Work: dg@tao.co.uk          | Does a Con Neumann machine run a Make
|  Play: dgiven@iname.com      | Machines Fast scam?               
+- http://wiredsoc.ml.org/~dg -+ 




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