From e4e8d775c00b8a1c33d4830422f1ccabe39ab126 Mon Sep 17 00:00:00 2001 From: StapleButter Date: Sun, 17 Dec 2017 02:11:28 +0100 Subject: libui/windows: don't explode if setWindowText() fails. fixes random crash when closing window. also add extra safety, can't hurt. --- src/libui_sdl/libui/windows/text.cpp | 3 +-- src/libui_sdl/main.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libui_sdl/libui/windows/text.cpp b/src/libui_sdl/libui/windows/text.cpp index af79fb8..a52af10 100644 --- a/src/libui_sdl/libui/windows/text.cpp +++ b/src/libui_sdl/libui/windows/text.cpp @@ -29,8 +29,7 @@ WCHAR *windowText(HWND hwnd) void setWindowText(HWND hwnd, WCHAR *wtext) { - if (SetWindowTextW(hwnd, wtext) == 0) - logLastError(L"error setting window text"); + SetWindowTextW(hwnd, wtext); } void uiFreeText(char *text) diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 61742b5..814d92c 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -755,6 +755,12 @@ void TryLoadROM(char* file, int prevstatus) int OnCloseWindow(uiWindow* window, void* blarg) { + if (RunningSomething) + { + EmuRunning = 2; + while (EmuStatus != 2); + } + uiQuit(); return 1; } -- cgit v1.2.3