Re: Unloading sequence of GTK



On Tue, 2006-03-21 at 17:24 +0100, Clemens Fruhwirth wrote:
> Milosz Derezynski <internalerror gmail com> wrote:
> 
> > From the docs GTK+ API docs:
> > 
> > gtk_main():
> > [...] You can nest calls to gtk_main(). In that case gtk_main_quit() will make the innermost invocation of the main loop return.
> > gtk_main_quit():
> > Makes the innermost invocation of the main loop return when it regains control.
> > 
> > You either need to clarify what you are exactly up to that seems
> > impossible to you with the current mechanics, 
> 
> You want the whole story? Ok fine.
> 
> I'm interested in developing a McCLIM backend for wxcl. McCLIM is a high
> level GUI toolkit for Common Lisp. I want to use wxcl for this
> task. wxcl=bindings for wxWidgets. The reason? The CL commmunity can't
> afford to maintain different backends for GTK/OS X/Windows. It's a
> question of menpower. 
> 
> wxWidgets relays on static initializations that it makes it impossible
> to call their entry functions more then once. Solutions -> reload the
> library. The problem with this? wxWidgets, more particular wxGTK loads
> GTK and GTK loads modules like theming itself. Because of this when
> wxGTK is dlclosed, the dynamic linker tries to close GTK too but because
> of the loaded modules (like theme engines) there are dependencies on
> libgtk. Those dependencies can't be unloaded as the responsiblity for
> loading them was with GTK. 
> 
> GTK must close this libraries otherwise, dlclose GTK won't succeed. If
> so only partially. Furthermore, we wxWidgets is reloaded some parts of
> GTK are reloaded some are still in memory. After playing tricks like
> these I get,

To repeat what Matthias said at the beginning, you can't unload GTK+.
Period. Well, more precisely, you might be able to unload GTK+, but
you couldn't load it again, which isn't exactly useful. (*)

You'll have to attack this some other way. I don't know anything about
wxWidgets, but I'd imagine that you could simply not try to initialize
it twice... if your module gets unloaded, don't actually unload the
C component, remember that you already initialized wxWidgets in a
static variable...

Regards,
					Owen

(*) Basically, it's impossible for GObject to know when a type is no
    longer in use, because we don't have garbage collection in C.
    So, if you unload and reload GTK+ again, referencing the
    type "GtkButton" is going to try to create a  button object from 
    the last copy of the GTK+ libraries.





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