Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dosbox-staging/dosbox-staging.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkcgen <kcgen@users.noreply.github.com>2022-06-06 18:05:56 +0300
committerkcgen <kcgen@users.noreply.github.com>2022-06-06 18:27:22 +0300
commit3f8b6e8124263799be76da55747ea566c15f78d6 (patch)
treeb3583ae4eca1ede462ce743a08341320ebe90f3e
parente50cceb693eca5210cc3716fb56e1a77bea062dc (diff)
Disengage frame render during output transitionskc/output-crash-1
-rw-r--r--src/gui/sdlmain.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp
index 5ea0bcc95..8b5284c7f 100644
--- a/src/gui/sdlmain.cpp
+++ b/src/gui/sdlmain.cpp
@@ -610,6 +610,14 @@ void GFX_ForceFullscreenExit()
return log;
}
+// Let the presentation layer safely call no-op functions.
+// Useful during output initialization or transitions.
+static void disengage_frame_rendering()
+{
+ sdl.frame.update = update_frame_noop;
+ sdl.frame.present = present_frame_noop;
+}
+
// This is a hack to prevent SDL2 from re-creating window internally. Prevents
// crashes on Windows and Linux, and prevents initial window from being visibly
// destroyed (for window managers that show animations while creating window,
@@ -1490,6 +1498,10 @@ Bitu GFX_SetSize(int width,
if (sdl.updating)
GFX_EndUpdate(nullptr);
+ disengage_frame_rendering();
+ // The rendering objects are recreated below with new sizes, after which
+ // frame rendering is re-engaged with the output-type specific calls.
+
const bool double_width = flags & GFX_DBL_W;
const bool double_height = flags & GFX_DBL_H;
@@ -3039,6 +3051,9 @@ static void set_output(Section *sec, bool should_stretch_pixels)
const auto section = static_cast<const Section_prop *>(sec);
std::string output = section->Get_string("output");
+ disengage_frame_rendering();
+ // it's the job of everything after this to re-engage it.
+
if (output == "surface") {
sdl.desktop.want_type = SCREEN_SURFACE;
} else if (output == "texture") {