[Galago-devel] Patch proposal: libnotify and dynamically linked modules
Holger Berndt
berndth at gmx.de
Tue Aug 8 23:58:57 EEST 2006
Hello,
I am experiencing problems with libnotify when used from a dynamically
loaded module. Once notify_init() is called from the module, the program
crashes when the module is unloaded again.
I assume the problem lies in the call to g_atexit() during
notify_init(). The glib reference manual says on g_atexit():
,----
| The behaviour of atexit() in the context of dynamically loaded modules is not
| formally specified and varies wildly.
|
| On POSIX systems, calling g_atexit() (or atexit()) in a dynamically loaded
| module which is unloaded before the program terminates might well cause a
| crash at program exit.
`----
(Source:
http://developer.gnome.org/doc/API/2.0/glib/glib-Miscellaneous-Utility-Functions.html#g-atexit)
In fact, I was able to reproduce crashes with simple calls to
g_atexit() in the module, without libnotify being involved at all.
I therefore propose to offer the possibility of initializing libnotify
without g_atexit() being called. A program doing that would of course
have to take care of calling notify_uninit() itself. Please see
attached patch for a possible solution that doesn't break the current
libnotify API. It introduces an additional init function called
notify_init_auto_uninit(), and makes notify_init() a wrapper around it.
(Patch against libnotify version 0.4.2).
This problem is a little surprising, because I assumed my configuration
(a notification plugin for an application, the whole thing
running on Linux) to be a rather typical one. So if any (portable) fixes
or workarounds already exist, I'd appreciate a hint.
Thanks and greetings,
Holger
-------------- next part --------------
A non-text attachment was scrubbed...
Name: no_atexit_notify.c.patch
Type: text/x-patch
Size: 1235 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/galago-devel/attachments/20060808/93acf3ad/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: no_atexit_notify.h.patch
Type: text/x-patch
Size: 702 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/galago-devel/attachments/20060808/93acf3ad/attachment-0001.bin
More information about the galago-devel
mailing list