From 1ee2ef928ce2a59226f2d47375e7f1554f4359de Mon Sep 17 00:00:00 2001 From: CasualPokePlayer <50538166+CasualPokePlayer@users.noreply.github.com> Date: Mon, 31 Jul 2023 15:55:36 -0700 Subject: [PATCH] Prevent SDL from doing windows message pumping Normally SDL doesn't do this as we don't ever call SDL_PumpEvents (or anything that calls that). However, OpenGL context creation code ends up calling WIN_PumpEvents regardless. This usually doesn't matter, however, in some cases, this can cause crashes, mainly with loading a state with Citra, as that ends up re-constructing its frame dumping OpenGL context (yeah that's dumb and useless but it's mostly harmless, outside of this message pumping). The WIN_PumpEvents calls appear to be unneeded anyways, so we can safely disable message pumping here. --- src/BizHawk.Bizware.Graphics/OpenGL/SDL2OpenGLContext.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/BizHawk.Bizware.Graphics/OpenGL/SDL2OpenGLContext.cs b/src/BizHawk.Bizware.Graphics/OpenGL/SDL2OpenGLContext.cs index e98991da04..6f133f6abd 100644 --- a/src/BizHawk.Bizware.Graphics/OpenGL/SDL2OpenGLContext.cs +++ b/src/BizHawk.Bizware.Graphics/OpenGL/SDL2OpenGLContext.cs @@ -39,6 +39,9 @@ namespace BizHawk.Bizware.Graphics // we will be turning a foreign window into an SDL window // we need this so it knows that it is capable of using OpenGL functions SDL_SetHint(SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL, "1"); + // don't allow windows events to be pumped + // it's not needed and can be dangerous in some rare cases + SDL_SetHint(SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, "0"); } private static readonly Lazy _version = new(() =>