aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2019-05-31 03:18:09 +0200
committerStapleButter <thetotalworm@gmail.com>2019-05-31 03:18:09 +0200
commitd8d7ba9251042fbef425509831fe5b642cf083f1 (patch)
tree440ec9d29eed2f6ed9849a46ee75d37d04036b05
parentc49dec1acdf2b90cb53364efa4ed525259c387d9 (diff)
fix potential crash when switching video output methods
-rw-r--r--src/libui_sdl/DlgVideoSettings.cpp4
-rw-r--r--src/libui_sdl/main.cpp7
2 files changed, 6 insertions, 5 deletions
diff --git a/src/libui_sdl/DlgVideoSettings.cpp b/src/libui_sdl/DlgVideoSettings.cpp
index 5c5d5f9..7d876e2 100644
--- a/src/libui_sdl/DlgVideoSettings.cpp
+++ b/src/libui_sdl/DlgVideoSettings.cpp
@@ -134,13 +134,15 @@ void OnRendererChanged(uiRadioButtons* rb, void* blarg)
ApplyNewSettings(2);
else
ApplyNewSettings(3);
+
+ uiControlSetFocus(uiControl(win));
}
void OnGLDisplayChanged(uiCheckbox* cb, void* blarg)
{
Config::ScreenUseGL = uiCheckboxChecked(cb);
ApplyNewSettings(2);
- uiControlSetFocus(uiControl(cb));
+ uiControlSetFocus(uiControl(win));
}
void OnThreaded3DChanged(uiCheckbox* cb, void* blarg)
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index 986a809..74d3fc9 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -2043,15 +2043,14 @@ void ApplyNewSettings(int type)
bool usegl = Config::ScreenUseGL || (Config::_3DRenderer != 0);
if (usegl != Screen_UseGL)
{
- Screen_UseGL = usegl;
-
if (RunningSomething)
{
- if (usegl) uiGLMakeContextCurrent(GLContext);
+ if (Screen_UseGL) uiGLMakeContextCurrent(GLContext);
GPU3D::DeInitRenderer();
- if (usegl) uiGLMakeContextCurrent(NULL);
+ if (Screen_UseGL) uiGLMakeContextCurrent(NULL);
}
+ Screen_UseGL = usegl;
RecreateMainWindow(usegl);
if (RunningSomething)