sdl12-compat icon indicating copy to clipboard operation
sdl12-compat copied to clipboard

Jivelite Issues

Open sodface opened this issue 3 years ago • 10 comments

Jivelite compiles with sdl12-compat on Alpine Linux but segfaults at launch:

(gdb) run
Starting program: /usr/bin/jivelite 

JiveLite 0.1.0

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f42482 in SDL_WM_SetIcon () from /usr/lib/libSDL-1.2.so.0
(gdb) bt
#0  0x00007ffff7f42482 in SDL_WM_SetIcon () from /usr/lib/libSDL-1.2.so.0
#1  0x0000555555563fa7 in jive_surface_set_wm_icon (srf=srf@entry=0x7ffff7895ae0) at jive_surface.c:982
#2  0x000055555556cb34 in jiveL_initSDL (L=0x7ffff7b7a380) at jive_framework.c:268
#3  0x00007ffff7e76fc5 in ?? () from /usr/lib/libluajit-5.1.so.2
#4  0x00007ffff7ecd61e in ?? () from /usr/lib/libluajit-5.1.so.2
#5  0x00007ffff7e76fc5 in ?? () from /usr/lib/libluajit-5.1.so.2
#6  0x00007ffff7ecd825 in lua_pcall () from /usr/lib/libluajit-5.1.so.2
#7  0x000055555555c20f in docall (clear=0, narg=1, L=0x7ffff7b7a380) at jive.c:385
#8  handle_script (n=0, argv=0x7fffffffec08, L=0x7ffff7b7a380) at jive.c:422
#9  pmain (L=0x7ffff7b7a380) at jive.c:524
#10 0x00007ffff7e76fc5 in ?? () from /usr/lib/libluajit-5.1.so.2
#11 0x00007ffff7ecd98d in lua_cpcall () from /usr/lib/libluajit-5.1.so.2
#12 0x000055555555aeaa in main (argc=1, argv=0x7fffffffec08) at jive.c:555

Jivelite looks for app.png at startup and if found, causes the segault, so the quick workaround is to rename or move the file out of the search path and then jivelite launches normally.

After launch, things appear to work ok until you switch workspaces and then switch back. On the switch back, it looks like the switch didn't occur as the screen does not change, however as soon as you press a key that jivelite would normally respond to (eg. arrow keys, spacebar etc.) the jivelite UI appears. I suppose the segfault and lack of screen refresh are two separate issues, please let me know if I should separate them out.

I've tested with with the latest git version of sdl12-compat.

sodface avatar Sep 13 '22 02:09 sodface

Can you build sdl12-compat with symbols and see where it's actually crashing?

slouken avatar Sep 13 '22 03:09 slouken

This might fix the crash, but doesn't explain why there's no icon surface, if that's what's happening: https://github.com/libsdl-org/sdl12-compat/commit/7df3288587905a224635001ff285a8d621cccb90

slouken avatar Sep 13 '22 03:09 slouken

This might fix the crash

This is a good fix regardless of anything else; SDL-1.2 checks for a NULL here and returns without doing anything, so we should have been doing so, too.

I'll look at the rest of the issues further in the morning.

icculus avatar Sep 13 '22 04:09 icculus

Can you build sdl12-compat with symbols and see where it's actually crashing?

Sorry about that, probably too late now but for my own knowledge, is this a better backtrace?

(gdb) run
Starting program: /usr/bin/jivelite 

JiveLite 0.1.0

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f3f158 in SDL_WM_SetIcon (icon12=0x0, mask=mask@entry=0x0) at /srv/aports/sodface.com/sdl12-compat/src/sdl12-compat-1cb01a574ace30b013efb1eef673207e28e99987/src/SDL12_compat.c:6698
6698	    if (SDL20_GetSurfaceBlendMode(icon12->surface20, &oldmode) < 0) {
(gdb) bt
#0  0x00007ffff7f3f158 in SDL_WM_SetIcon (icon12=0x0, mask=mask@entry=0x0)
    at /srv/aports/sodface.com/sdl12-compat/src/sdl12-compat-1cb01a574ace30b013efb1eef673207e28e99987/src/SDL12_compat.c:6698
#1  0x0000555555563fa7 in jive_surface_set_wm_icon (srf=srf@entry=0x7ffff7895b30) at jive_surface.c:982
#2  0x000055555556cb34 in jiveL_initSDL (L=0x7ffff7b7a380) at jive_framework.c:268
#3  0x00007ffff7e76fc5 in ?? () from /usr/lib/libluajit-5.1.so.2
#4  0x00007ffff7ecd61e in ?? () from /usr/lib/libluajit-5.1.so.2
#5  0x00007ffff7e76fc5 in ?? () from /usr/lib/libluajit-5.1.so.2
#6  0x00007ffff7ecd825 in lua_pcall () from /usr/lib/libluajit-5.1.so.2
#7  0x000055555555c20f in docall (clear=0, narg=1, L=0x7ffff7b7a380) at jive.c:385
#8  handle_script (n=0, argv=0x7fffffffec08, L=0x7ffff7b7a380) at jive.c:422
#9  pmain (L=0x7ffff7b7a380) at jive.c:524
#10 0x00007ffff7e76fc5 in ?? () from /usr/lib/libluajit-5.1.so.2
#11 0x00007ffff7ecd98d in lua_cpcall () from /usr/lib/libluajit-5.1.so.2
#12 0x000055555555aeaa in main (argc=1, argv=0x7fffffffec08) at jive.c:555

This might fix the crash, but doesn't explain why there's no icon surface, if that's what's happening:

Tested and indeed it does fix the crash. Thanks!

Still seeing the screen update (not sure what to call it) issue that requires a key press when switching workspaces and then switching back again. Jivelite doesn't crash so I'm not sure how to provide more helpful info.

sodface avatar Sep 13 '22 11:09 sodface

I haven't been able to coerce Jivelite to compile yet; I'll throw together an Alpine Linux install, in case there's a prebuilt package there (or at least a more compatible build environment), but if you have a moment, could you try the nuclear option and see if it fixes rendering for you?

export SDL_RENDER_DRIVER="software"
export SDL_FRAMEBUFFER_ACCELERATION="false"

icculus avatar Sep 13 '22 23:09 icculus

I tested with the two environment variables and it made no difference when switching workspaces. The APKBUILDS I'm using are here. Compiled packages are here.

sodface avatar Sep 14 '22 01:09 sodface

I'm going to bump this out of the milestone because we're about to ship and I haven't had a chance to put together an Alpine install yet. I'll look at this soon, though!

icculus avatar Sep 16 '22 14:09 icculus

So I haven't managed to build this thing yet, but it's possible the SDL_UpdateRects race condition fix we made affects this. If you have time, let me know if the latest in git fixes rendering in Jivelite, too.

icculus avatar Oct 11 '22 20:10 icculus

I recompiled latest sdl12-compat and jivelite and unfortunately I'm not seeing any improvement. Jivelite launches and looks ok until you switch workspaces and then switch back. The GUI isn't visible on switch back until you press a key or click the mouse within the (invisible) window.

sodface avatar Oct 13 '22 04:10 sodface

I'm no longer seeing this issue. Not sure what fixed it but feel free to close this at your discretion. Thanks for the support!

sodface avatar Apr 09 '24 11:04 sodface

I wasn't ever able to track this down, so I'm totally fine with closing it! :)

icculus avatar Apr 09 '24 22:04 icculus