I'm running the latest version (0.2.5e).
Pico8 works fine when you link your own SDL library and change the video driver.... Until you press alt+enter (fullscreen toggle). Pressing that makes pico8 have a segfault under linux:
> SDL_VIDEODRIVER=wayland /opt/pico8/pico8_dyn zsh: segmentation fault (core dumped) SDL_VIDEODRIVER=wayland /opt/pico8/pico8_dyn |
Same thing with kmsdrm:
> SDL_VIDEODRIVER=kmsdrm /opt/pico8/pico8_dyn zsh: segmentation fault (core dumped) SDL_VIDEODRIVER=kmsdrm /opt/pico8/pico8_dyn |
But it doesn't happen with the default for linux (x11):
> SDL_VIDEODRIVER=x11 /opt/pico8/pico8_dyn |
Here is an excerpt of my valgrind trace:
Memcheck, a memory error detector Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info Command: /opt/pico8/pico8_dyn -windowed 0 Invalid read of size 8 at 0x4974C15: SDL_GL_MakeCurrent_REAL (SDL_video.c:4114) by 0x48F0449: GL_ActivateRenderer (SDL_render_gl.c:268) by 0x48F0736: GL_DestroyTexture (SDL_render_gl.c:1520) by 0x48E7E84: SDL_DestroyTexture_REAL.part.0 (SDL_render.c:4394) by 0x48EEB04: SDL_DestroyTexture_REAL (SDL_render.c:4415) by 0x48EEB04: SDL_DestroyRenderer_REAL (SDL_render.c:4433) by 0x5111F2: codo_set_screen_plat (in /opt/pico8/pico8_dyn) by 0x50F1F4: codo_handle_system_messages (in /opt/pico8/pico8_dyn) by 0x4B7BD6: codo_main (in /opt/pico8/pico8_dyn) by 0x4B9528F: (below main) (libc_start_call_main.h:58) Address 0xb4a9f60 is 0 bytes inside a block of size 240 free'd at 0x484426F: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4920BFE: SDL_free_REAL (SDL_malloc.c:5461) by 0x5111D6: codo_set_screen_plat (in /opt/pico8/pico8_dyn) by 0x50F1F4: codo_handle_system_messages (in /opt/pico8/pico8_dyn) by 0x4B7BD6: codo_main (in /opt/pico8/pico8_dyn) by 0x4B9528F: (below main) (libc_start_call_main.h:58) Block was alloc'd at at 0x4846A73: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4920B60: SDL_calloc_REAL (SDL_malloc.c:5433) by 0x4975823: SDL_CreateWindow_REAL (SDL_video.c:1698) by 0x51150A: codo_set_screen_plat (in /opt/pico8/pico8_dyn) by 0x509DC4: codo_set_screen (in /opt/pico8/pico8_dyn) by 0x4082C9: codo_main_init (in /opt/pico8/pico8_dyn) by 0x4B7BBE: codo_main (in /opt/pico8/pico8_dyn) by 0x4B9528F: (below main) (libc_start_call_main.h:58) |
If I just completely skip the "SDL_DestroyRenderer" function call (by commenting it out in sdl & recompiling the library), then there is no segfault.
I'm curious why the SDL_Renderer (and SDL_Window I think) have to be destroyed when switching between fullscreen and windowed mode. Could something like this be used instead?
https://wiki.libsdl.org/SDL2/SDL_SetWindowFullscreen
Also, being able to disable alt+enter would be a nice feature. It doesn't make much sense for some tiling window managers and with running pico-8 without a desktop environment.
[Please log in to post a comment]