Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: segfault on window-close / quit #792

Open
metaleap opened this issue Jan 17, 2024 · 1 comment
Open

Linux: segfault on window-close / quit #792

metaleap opened this issue Jan 17, 2024 · 1 comment
Labels
bug Need to fix

Comments

@metaleap
Copy link

metaleap commented Jan 17, 2024

(Since this happens only on-quit, I guess it isn't too critical/urgent... but for completeness' sake I'll file it here =)

With a libWickedEngine_Linux.so Release-with-Debug-symbols build labelling itself on-window as v0.71.357 (~late Dec master branch iirc), Linux (6.6.10-zen1-1-zen) with X11 (not Wayland), NVIDIA RTX 4090 driver 545.29.06.

Based on Template_Linux, this minimalist main.cpp, which is the only source file in this program:

#include <cstdio>

#include <SDL2/SDL.h>
#include <WickedEngine.h>


void mainLoop(wi::Application&);

int main() {
    wi::renderer::SetShaderSourcePath("../libdeps/WickedEngine/WickedEngine/shaders/");
    wi::renderer::SetShaderPath("../.cache/shaders/");

    wi::Application app;
    app.infoDisplay.active = true;
    app.infoDisplay.watermark = true;
    app.infoDisplay.resolution = true;
    app.infoDisplay.fpsinfo = true;

    sdl2::sdlsystem_ptr_t sdl_sys = sdl2::make_sdlsystem(SDL_INIT_EVERYTHING | SDL_INIT_EVENTS);
    sdl2::window_ptr_t sdl_win = sdl2::make_window("HeloWick", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1440, 960,
                                                   SDL_WINDOW_SHOWN | SDL_WINDOW_VULKAN | SDL_WINDOW_ALLOW_HIGHDPI
                                                       | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE);
    app.SetWindow(sdl_win.get());
    mainLoop(app);
    SDL_Quit();
    return 0;
}

void mainLoop(wi::Application& app) {
    SDL_Event sdl_evt;

    bool quit = false;
    while (!quit) {
        SDL_PumpEvents();
        app.Run();

        while (SDL_PollEvent(&sdl_evt))
            switch (sdl_evt.type) {
                case SDL_QUIT:
                    quit = true;
                    break;
                case SDL_WINDOWEVENT:
                    switch (sdl_evt.window.event) {
                        case SDL_WINDOWEVENT_CLOSE:
                            quit = true;
                            break;
                        case SDL_WINDOWEVENT_RESIZED:
                            app.SetWindow(app.window);
                            break;
                    }
                    break;
            }
    }
}

segfaults on Alt+F4 (does jump into SDL_WINDOWEVENT_CLOSE case) with gdb debugger breaking/line-highlighting at WickedEngine/wiGraphicsDevice_Vulkan.h#L518

Output in VSCode's Debug Console:

1 "mo3d.exec" received signal SIGSEGV, Segmentation fault.
0x00007ffff6aaddb4 in pthread_mutex_lock () from /usr/lib/libc.so.6
@klaussilveira
Copy link

Which SDL version are you using? Did you build it yourself, or are you using your distro's? If the distro one, which distro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Need to fix
Projects
None yet
Development

No branches or pull requests

3 participants