AmatCoder / mednaffe

A front-end (GUI) for mednafen emulator
GNU General Public License v3.0
429 stars 35 forks source link

Aborts on quit #34

Closed not-a-user closed 8 years ago

not-a-user commented 8 years ago

When quitting the gui (via File menu or using Ctrl+Q) I get

*** stack smashing detected ***: mednaffe terminated
Aborted (core dumped)

The nasty side effect of this is that the rom folders selected are not saved and the game list is empty when starting the next time.

At startup I always get

Starting Mednaffe 0.8.1
Mednafen 09x configuration file found.
Version detected: Mednafen 0.9.38.7
----
(mednaffe:11966): GLib-CRITICAL **: g_ascii_strtod: assertion 'nptr != NULL' failed
(mednaffe:11966): GLib-CRITICAL **: g_ascii_strtod: assertion 'nptr != NULL' failed
(mednaffe:11966): GLib-CRITICAL **: g_ascii_strtod: assertion 'nptr != NULL' failed
(mednaffe:11966): GLib-CRITICAL **: g_ascii_strtod: assertion 'nptr != NULL' failed
(mednaffe:11966): GLib-CRITICAL **: g_ascii_strtod: assertion 'nptr != NULL' failed

but everything works fine until I quit.

I'm on https://github.com/AmatCoder/mednaffe/commit/e2d8d0311e98dbd7d56a9c29e4b5d51ecc76c52c because I'm running Mednafen 0.9.38.7.

Happens with and without --enable-gtk3.

I'm on Ubuntu 16.04 i686 with lxde ("Lubuntu" installation).

Update

I have no abort issues on Debian Jessie x86_64 with Cinamon ("LMDE 2" installation) and stock Mednafen 0.9.36.4. However the GLib-CRITICAL messages are there as well, so they are probably not important here.

AmatCoder commented 8 years ago

You must use a6c4456 (or official release) or compile the last version of mednafen emulator (0.9.39.x).

not-a-user commented 8 years ago

With https://github.com/AmatCoder/mednaffe/commit/a6c445641347e60363c85a8f946ed6a59d7a1a3d the GLib-CRITICAL messages are gone, but it still aborts on Quit and does not preserve Game List.

Same with https://github.com/AmatCoder/mednaffe/commit/ca65f59ffae259e4aaf62222f65d4c8354aa5602 (release v0.8).

Latest Mednafen does not build here.

AmatCoder commented 8 years ago

Please, try deleting mednafen-09x.cfg and mednaffe.conf configuration files.

not-a-user commented 8 years ago

Removing ~/.mednafen/mednafen-09x.cfg: No change.

There is never a mednaffe.conf created. - That is my problem.

not-a-user commented 8 years ago

From the default valgrind memchecker:

==3207== Process terminating with default action of signal 6 (SIGABRT)
==3207==    at 0x4D22E89: raise (raise.c:54)
==3207==    by 0x4D243E6: abort (abort.c:89)
==3207==    by 0x4D5E25B: __libc_message (libc_fatal.c:175)
==3207==    by 0x4DEE7C7: __fortify_fail (fortify_fail.c:37)
==3207==    by 0x4DEE757: __stack_chk_fail (stack_chk_fail.c:28)
==3207==    by 0x8052200: save_systems_showed (in /usr/local/bin/mednaffe)
==3207==    by 0x8052413: save_prefs (in /usr/local/bin/mednaffe)
==3207==    by 0x804E13D: quit (in /usr/local/bin/mednaffe)
==3207==    by 0x425B6AF: ??? (in /usr/lib/i386-linux-gnu/libgtk-3.so.0.1800.9)
==3207==    by 0x4B5ED8E: ??? (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.4800.1)
==3207==    by 0x4B792F7: g_signal_emit_valist (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.4800.1)
==3207==    by 0x4B79FC4: g_signal_emit (in /usr/lib/i386-linux-gnu/libgobject-2.0.so.0.4800.1)
not-a-user commented 8 years ago

Dirty workaround: Build with

CC='gcc -fno-stack-protector' ./configure --enable-gtk3 && CC='gcc -fno-stack-protector' make

Result: Works.

not-a-user commented 8 years ago

save_systems_showed in https://github.com/AmatCoder/mednaffe/blob/master/src/prefs.c is bad:

It allocates 13 booleans, iterates over an unchecked number of them, and the forwards 15 to gtk.

AmatCoder commented 8 years ago

You are right. It has been fixed on e58c719.

Thanks for debugging this. Really appreciated.