Ticket #86 (defect)

Opened 3 years ago

Last modified 3 years ago

Possible crash in dynamically linked modules using libnotify

Status: closed (fixed)

Reported by: berndth Assigned to: chipx86@chipx86.com
Priority: normal Milestone:
Component: libnotify Version:
Severity: normal Keywords:
Cc: berndth@gmx.de D-BUS Version:
Patch Included: 1 OS/Distro Version:

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: GLib Reference Manual)

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 a way to initialize libnotify without g_atexit(). Christian Hammond told me in an email that just dropping the call during initialization would be fine, so I am attaching a micro-patch to fix this issue.

Attachments

no_atexit.patch (317 bytes) - added by berndth on 08/24/06 08:39:44.

Change History

08/24/06 08:39:44: Modified by berndth

  • attachment no_atexit.patch added.

08/31/06 00:54:10: Modified by berndth

  • cc set to berndth@gmx.de.

09/03/06 23:45:44: Modified by chipx86

  • status changed from new to closed.
  • resolution set to fixed.

(In [2898]) Patch by berndth to stop using g_atexit, as this can fail in the case of a dynamically loaded module. Applications should now call notify_uninit() on exit or on plugin unload. This closes bug #86.