Changing video options from menu cause segfaults

Issue #276 resolved
Manuel Alfayate Corchete created an issue

Hello again, sorry for reporting so many bugs on a row, I hope this is the last one (but I love ECWolf too much to ignore them).

When toggling FULLSCREEN, VSYNC and RESOLUTION on the menu (individually or one after the other) the game sometimes freezes, segfaults, etc. Maybe something to do with SDL2 video-reinitialization between changes? I suspect anything similar.

It happens on different SDL2 backends: X11/GLES and also KMSDRM/GLES.

Comments (8)

  1. Braden Obrzut

    No need to apologize for reporting bugs.

    What’s amazing about this is that it’s only happening now. It’s an uninitialized value that’s causing the issue although I can’t see why, 1) valgrind hasn’t complained about this, and 2) why hasn’t this been an issue for years. I want to do a little investigation to see if there’s some other issue that was masking this, but the fix should be as simple as initializing Renderer and Texture to NULL in SDLFB::SDLFB.

  2. Manuel Alfayate Corchete reporter

    In case it helps, I have tried initializing those to NULL just at the beginning of SDLFB::SDLFB, and I am still getting the segfaults.

  3. Braden Obrzut

    Found there were two technically unrelated functions that were named ToggleFullscreen. Shouldn’t have been the issue since they were separate symbols according to C++ overloading. I do see that Renderer/Texture get NULLed a little later in SDLFB::SDLFB so I tried getting rid of those after adding them closer to the beginning. Toggling resolutions, vsync, and fullscreen all work for me.

    So if it’s still crashing with afbb0e669c44a148eea80ce7108d826ba2d839c9 can you get a back trace in GDB?

  4. Manuel Alfayate Corchete reporter

    It does not segfault anymore with that commit, good!

    However, I have found out that if I deactivate VSYNC and activate it again, it will not activate until I quit ECWolf and load it again. Other settings like FULLSCREEN and VIDEOMODE can be toggled and they respond as expected.

  5. Braden Obrzut

    Works fine for me. Kubuntu 20.04 with FirePro W7100 (GCN 3; 285/380/380X equivalent) using stock Mesa driver.

  6. Manuel Alfayate Corchete reporter

    @Braden Obrzut Thanks, it works here too using the X11 SDL2 backend, so it must be KMS/DRM related, nothing to do with ECWolf itself. Sorry.

  7. Log in to comment