Re: Crash on exit



On Thu, 15 Jun 2000, David Benson wrote:
> The problem is probably due to gtk's use of atexit(3).
> Basically, I'm guessing that the gtk+ library has
> been unloaded and so the function pointer passed to atexit
> is no longer valid.
> 
> On shutdown, libc attempts to invoke the functions
> registered at atexit, and dies b/c they were unloaded.
> 
> It will be totally dirty, but you try one of the following:
> 	- call _exit instead of exit
> 	- set LD_PRELOAD=/usr/lib/glib.so:/usr/lib/gtk.so
> 	  [untested, may not work]
> 	- set LD_PRELOAD to something which contains a g_atexit
> 	  which does nothing.

By God, you've hit the nail on the head. Both calling _exit() and
setting LD_PRELOAD to the library list methods work. However, there are
still disadvantages. Calling _exit() will not flush and close open
streams, and while PHP certainly shouldn't have any open streams by the
time it calls exit(), it's still a consideration. As for the LD_PRELOAD,
will it work on all systems? Even if it does, that's requiring user to
set something in their environment just to run a program, which is not
very nice.

Are there any other solutions? How do other bindings do it? Python is
obviously not linked with libgtk..

-Andrei

Any sufficiently advanced Operating System
is indistinguishable from Linux.
                              - Jim Dennis




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