Thanks to visit codestin.com
Credit goes to github.com

Skip to content

crash at program termination after using gtk native file chooser #6

@osch

Description

@osch

In the example editor.lua the program is terminated with os.exit(true, true). This leads to a crash after the gtk native file chooser was invoked (at least under current Manjaro Linux, latest release MoonFLTK 0.5 und also current git master), stacktrace:

#0  0x00007f510e851bc5 in getenv () at /usr/lib/libc.so.6
#1  0x00007f5105a0b4b0 in  () at /usr/lib/libcanberra.so.0
#2  0x00007f510f587af3 in _dl_fini () at /lib64/ld-linux-x86-64.so.2
#3  0x00007f510e852448 in __run_exit_handlers () at /usr/lib/libc.so.6
#4  0x00007f510e85249a in  () at /usr/lib/libc.so.6
#5  0x0000562b55393741 in os_exit (L=0x562b56989268) at loslib.c:379

The program does not crash if terminating with os.exit(true, false) or if the FLTK file chooser is used instead of the GTK one.

The problem is, that the second true argument in os.exit leads to closing the lua_State before the exit handlers are called. In lua source loadlib.c one can see that closing the lua state unloads all native shared objects, e.g. moonfltk.so. Unloading moonfltk.so seems to unload some other shared objects that are needed by another exit handler: if the call to dlclose in lua/loadlib.c is commented out, than no crash does occur.

I did not find a better solution than just quitting the application with os.exit(true, false).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions