murkymark / sdlgui

C++ GUI system (graphical user interface) for libSDL 1.2.x with optional OpenGL support
0 stars 0 forks source link

Crash in void load(Button* ptr) when closing window "fast" #1

Open Ravenbs opened 4 years ago

Ravenbs commented 4 years ago

Hello,

I create a window and close it with:

                myWindow->dispose();
                myWindow= NULL;
                sdlGUIManager->relayout();

If I do this within 5 Seconds -> I get a Nullpointer exception in this function:

  void load(Button* ptr)
  {
    Button* button = ptr;
    AsyncTexture* self = this;
    std::thread tgr([=]() {
      std::lock_guard<std::mutex> guard(button->theme()->loadMutex); <<<<<<<<<<<

Seems when a Window is closed the running rendering threads are not stopped and try to render a deleted object?

Did I do something wrong how to close the window? Took me hours to find out how to close a window, this is not explained in any place (example or documentation) of SDLGui nor in NanoGUI. Seems noone ever closes windows ^^. And for not native speakers "dispose" does not really translate to something realted to "close" "delete" "void",...

Is it normal that the graphic update threads take lots of seconds where the windows are flickering? Any setting to do this syncron or speed window update up to avoid flickering?

shezik commented 1 year ago

Where's the code??