libretro / hatari

New rebasing of Hatari based on Mercurial upstream. Tries to be a shallow fork for easy upstreaming later on.
25 stars 41 forks source link

Fix segfault when loaded without content. #23

Closed orbea closed 6 years ago

orbea commented 6 years ago

My understanding is this is a combination of a frontend bug in RetroArch and a core bug in hatari. RetroArch attempts to unload content even when it was never loaded and hatari is deiniting content in retro_deinit instead of retro_unload_core.

Please see:

https://github.com/libretro/RetroArch/issues/4493 https://github.com/libretro/RetroArch/pull/7102

Note that this fix in hatari also requires the fix in RetroArch.

This also removes the executive permissions of 0755 from Makefile.libretro to the correct permissions of 0644.

orbea commented 6 years ago

For reference here is a backtrace for hatari.

Thread 1 "retroarch" received signal SIGSEGV, Segmentation fault.
0x00007ffff03ab8b0 in texture_uninit () at libretro/hatari-mapper.c:194
194    if(sdlscrn->format)  
(gdb) bt
#0  0x00007ffff03ab8b0 in texture_uninit () at libretro/hatari-mapper.c:194
#1  0x00007ffff03aae33 in Emu_uninit () at libretro/libretro.c:144
#2  0x00007ffff03ab2eb in retro_deinit () at libretro/libretro.c:231
#3  0x000000000041193c in core_unload () at core_impl.c:397
#4  0x000000000041af04 in command_event_deinit_core (reinit=true)
    at command.c:1087
#5  0x000000000041d038 in command_event (cmd=CMD_EVENT_CORE_DEINIT, data=0x0)
    at command.c:2291
#6  0x000000000041420b in retroarch_main_init (argc=3, argv=0x7fffffffe1e8)
    at retroarch.c:1428
#7  0x000000000042e62e in content_load (info=0x7fffffffe0b0)
    at tasks/task_content.c:279
#8  0x000000000042f798 in task_load_content (content_info=0x7fffffffe0b0, 
    content_ctx=0x7fffffffdfc0, launched_from_menu=true, launched_from_cli=true, 
    error_string=0x7fffffffdfb8) at tasks/task_content.c:880
#9  0x0000000000430c37 in task_load_content_callback (
    content_info=0x7fffffffe0b0, loading_from_menu=true, loading_from_cli=true)
    at tasks/task_content.c:1565
#10 0x0000000000430de4 in task_push_load_content_from_cli (core_path=0x0, 
    fullpath=0x0, content_info=0x7fffffffe0b0, type=CORE_TYPE_PLAIN, cb=0x0, 
    user_data=0x0) at tasks/task_content.c:1633
#11 0x00000000004101b9 in rarch_main (argc=3, argv=0x7fffffffe1e8, data=0x0)
    at frontend/frontend.c:125
#12 0x000000000041023c in main (argc=3, argv=0x7fffffffe1e8)
    at frontend/frontend.c:169

Also see https://github.com/libretro/libretro-lutro/pull/123.

orbea commented 6 years ago

The travis wiiu failure is unrelated to this PR.

LD objs/wiiu-salamander/retroarch_wiiu_salamander.rpx.elf
/home/buildbot/tools/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/6.3.0/../../../../powerpc-eabi/bin/ld: cannot find -lpng
/home/buildbot/tools/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/6.3.0/../../../../powerpc-eabi/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
orbea commented 6 years ago

Given that this was fixed another way in lutro, maybe there is a better fix for this? I'll look into it later.

orbea commented 6 years ago

I don't think this solution is correct, I'll close this and make a PR shortly for a better fix.