Re: Potential need for librsvg API breakage



On Wed, 1 Nov 2006, Dominic Lachowicz wrote:

Hi,

So I'm currently faced with a dilemma that's hitting a lot of users,
causing their applications to crash and otherwise behave badly. I'd
appreciate if people might offer any insight they had on the issue.

In the 2.16.x series, librsvg's fundamental "type", the RsvgHandle,
became a subclass of GObject, and is registered via
g_type_register_static(). AFAIK, this relationship isn't exposed in
any way that the public ABI is concerned (i.e. RsvgHandle is just a
anonymous typedef in the header file).

The problem is that librsvg is a library that gets used by a lot of
plugins - I can think of at least 3 places: AbiWord's image loader,
GdkPixbuf's "loader" architecture, and GTK+'s theme engine. Some of
these (GTK+'s theme engine bits come to mind) make heavy use of what
GObject calls "dynamic types" that get loaded/unloaded as necessary,
and the GModule that ultimately called
g_type_register_static(RSVG_TYPE_HANDLE, ...) may get unloaded.

this is already broken and has to be fixed. if you want to be able to unload a type implementaiton, you MUST
use g_type_register_dynamic.
using g_type_register_static and unloading its implementaiton is as
good as dlopen(); atexit(dlsym()); dlclose();
the alternative is of course to make the module effectively unloadable
by means of g_module_make_resident or dlopen(self) once loaded.

Since
there is no way to signal that types need to be unregistered, this
causes subsequent registration of the RsvgHandle type to fail, and
lots of code to go belly-up. This is bad.

Now, I don't intend to pass judgment on the type registration system.
I just want to come up with the best way to fix the problem I'm
encountering. I can think of a few solutions, but I welcome other
ideas and suggestions for implementing my proposals.

3) Whatever you all come up with

i'm not sure what exactly your problem is here.
if it's just the combo of g_type_register_static + unloading,
simply prevent unloading or use g_type_register_dynamic.
if it's something else, i didn't manage to grasp it from your email ;)

Thanks for your help and understanding,
Dom

---
ciaoTJ



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