Re: Crash on exit



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.

- Dave

On Thu, 15 Jun 2000, Andrei Zmievski wrote:

> Ok, more interesting information on this. Owen mentioned that it's
> probably related to the way the .so file is loaded/unloaded.  While
> testing this today again, I happened to compile PHP with libs from
> gtk-config --libs and the whole thing worked. So, when it's linked with
> GTK+ libs - it loads .so file just fine and there is no crash on exit.
> When it's not linked with GTK+ libs, the below mentioned crash happens.
> Obviously, I can't require people to link their PHP with GTK+ libs if my
> module is going to be distributed separately... Any ideas?
> 
> 
> > I am starting to develop PHP bindings for GTK+ and I am having a problem
> > where a crash occurs on shutdown. Basically, the bindings code is in an
> > .so library which gets loaded by PHP. The gtk_init_check() works, but
> > the core file says this:
> > 
> > (gdb) bt
> > #0  _dl_lookup_symbol (undef_name=0x4035f681 "free", ref=0xbffff594,
> > symbol_scope=0x818b566, 
> >     reference_name=0x818b390 "/usr/X11/lib/libXext.so.6", reloc_type=7)
> > at do-lookup.h:82
> > #1  0x4000a823 in fixup (l=0x818b3b0, reloc_offset=1968265216) at
> > dl-runtime.c:88
> > #2  0x4000a970 in _dl_runtime_resolve () at dl-runtime.c:182
> > #3  0x4035b959 in XInputClose () from /usr/X11/lib/libXi.so.6
> > #4  0x40385bae in XCloseDisplay () from /usr/X11/lib/libX11.so.6
> > #5  0x4030a143 in gdk_exit_func () at gdk.c:1007
> > #6  0x400f425a in exit (status=0) at exit.c:57
> > #7  0x400eb9d1 in __libc_start_main () at
> > ../sysdeps/generic/libc-start.c:92
> > 
> > I've double-checked and the argc/argv passed to gtk_init_check() are
> > correct. What could be the source of this problem?
> 
> -Andrei
> * It's an emergent property of human minds to create. *
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 





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