> >Hi, > >I'm currently writing an application that makes use of bonobo controls. I'm >using bonobo_widget_new_control_async() and related functions to load controls >in my application. Eventually I need to destroy explicitly the widget that >displays the control. As what I get from loading the control is a BonoboWidget, >which in turn is a GtkWidget, I thought that simply using gtk_widget_destroy() >would destroy the widget containing it and properly release the control: > > widget = bonobo_widget_new_control_async (...); > > /* > * Later... > */ > > gtk_widget_destroy (widget); > >However, I noticed that after the call to gtk_widget_destroy() the control >process is still running on the background, which makes me think that I forgot >to release some kind of "reference" to it. The only things I do with the bonobo >widget is getting the control frame and the popup UI component (which I release >properly before trying to destroy the widget): > > widget = bonobo_widget_new_control_async (...); > > /* > * Do the following when the async callback gets called... > */ > > frame = bonobo_widget_get_control_frame (widget, ...); > uic = bonobo_control_frame_get_popup_component (frame, ...); > > /* > * Later... > */ > > bonobo_object_unref (uic); > gtk_widget_destroy (widget); > >I imagine I must be missing something, but I don't know what and I couldn't find >any documentation or examples on it. One of the things I've deeply looked at was >the gnome-panel sources (especially the part related to loading/unloading >applets). I've seen that it explicitly releases the CORBA object using >CORBA_Object_release(). However it doesn't use >bonobo_widget_new_control_async(), instead it uses >bonobo_widget_new_control_from_objref(), so I'm still not sure about that to do. > >Could anyone help me with this? > >Thanks in advance! >Adriano Hi Adriano You've found a leak in bonobo_widget code. Actually there is control_new_async_cb in bonobo-widget.c function that should unref control when everything is done. Or you can do it manually in callback. See the example I've wrote for you. Please file a bug about that, patch is also welcome. Actually we have another long-standing problem - bonobo object leak in filechooser, so every control that runs filechooser will never exit. I wish someone find a time to add one line fix for http://bugzilla.gnome.org/show_bug.cgi?id=145200
Attachment:
test-control.c
Description: Binary data