removing widgets from a container



 Hello,

 I guess this is a simple question...

 first, I have an struct where I save the contents of a gtk_container
(mystruct->widget for example), so, I create the widget, I store the
pointer in my struct (by the way, a static global one) and I add the
widget to the gtk_container. All is normal till here

 later, I change the contents of the gtk_container with this code:

 /* clean all pending events */
 while ( gtk_events_pending() )
	gtk_main_iteration();

 /* remove the old widget */
 if ( GNOME_APP(appGlobal->contents) )
 {
	gtk_container_remove (  GTK_CONTAINER
(GNOME_APP(appGlobal)->contents->parent),
				GNOME_APP(appGlobal)->contents);
 }

 gnome_app_set_contents ( GNOME_APP(appGlobal), logo);


 I discovered that after gtk_container_remove... the pointer in my
previus struct (mystruct) is pointing to a non valid widget (for
example, the widget name contains random data)

 So, I supose that gtk_container_remove will destroy my widgets...

 but as I have some signals connected to this widget, it seems that
these signals are still working (and I clean the events before the
gtk_container_remove call)

 I dont know how can I destroy this widget cleanly... any suggestion?

-- 
signed
          derethor of centolos




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