Re: Using static types from a GTypeModule

ext Tim Janik wrote:
in your case, it sounds like your plugin loads the gtk library
on demand, so it gets unloaded once your plugin is unloaded.
if that is the case, fix your code so Gtk+ never gets unloaded
(usually it's best to have the application link against Gtk+,
so dynamic plugins can rely on it being present instead of
pulling it in).

Yes, I tend to agree that Gtk+ case is rather specific and that usually the whole application links with Gtk+, so there are no real problem there. Still, the point applies to other libraries, such as DBus-glib (it uses g_boxed_type_register_static()) or any library which registers any static GType: the application cannot know what libraries the plugins are linked to, and in most cases even if it new, it wouldn't want to keep the libraries loaded when they are unneeded.

For applications which are running all the time and make an intensive use of module plugins, like the Hildon desktop, the waste of resources can become considerable.

I'm not convinced that the solution is to convert all libraries using static types need to use dynamic types -- I'd rather have some workaround in glib. What about allowing g_type_register_static() to overwrite the previous existing type when asked to re-register an already known type, instead of failing?

It doesn't sound a clean solution at all, but...


-- <-- Geek in un lingua international!

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