Re: SEGV when dlopen()ing Gnome code



>    This may be a practical way to do things, because one doesn't have to
> bother where data is unallocated, but it looks awful to me. I'd rather
> have these callbacks called at the end of gtk_main() or gnome_main().

You can't do it this way because you are meant to be able to have nested
(for lack of the right word?) gtk_main() loops.

Jeff

> 
>    For those interested, I found a workaround. It's absolutely ugly,
> and I don't recommend reading the next few sentences to people with
> epilepsy or heart problems. I export a function called g_atexit in my
> code, which stores the gtk and gdk callbacks in a private structure
> instead of calling atexit(). When dlopen()ing the shared object, my
> g_atexit symbol is resolved before Glib's one, which means that when
> calling gnome_init(), my private g_atexit is called. Then I call these
> stored callbacks just after gtk_main() has finished. The library can
> eventually be safely dlclosed().
> 
>    Well, at least my application doesn't segfault on exit anymore and
> now loads and unloads its Gnome interface on request. But I agree this
> is rather kludgey.
> 
> Regards,
> Sam.
> -- 
> Samuel Hocevar <sam zoy org> <http://sam.zoy.org/>
> for DVDs in Linux screw the MPAA and ; do dig $DVDs.z.zoy.org ; done | \
>       perl -ne 's/\.//g; print pack("H224",$1) if(/^x([^z]*)/)' | gunzip
> 
> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-devel-list





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