From d8acd46319038c1a892d68a5f2b4b464c252396e Mon Sep 17 00:00:00 2001 From: Tommy Li Date: Sun, 22 Dec 2019 12:56:39 -0600 Subject: [PATCH] More synchronous call to the main thread to avoid crashes --- src/arch/LowLevelWindow/LowLevelWindow_MacOSX.mm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/arch/LowLevelWindow/LowLevelWindow_MacOSX.mm b/src/arch/LowLevelWindow/LowLevelWindow_MacOSX.mm index eabbc3a95c..e871612d0b 100644 --- a/src/arch/LowLevelWindow/LowLevelWindow_MacOSX.mm +++ b/src/arch/LowLevelWindow/LowLevelWindow_MacOSX.mm @@ -425,9 +425,10 @@ RString LowLevelWindow_MacOSX::TryVideoMode( const VideoModeParams& p, bool& new m_BGContext = nil; } } - - [m_Context setFullScreen]; - [m_Context update]; + dispatch_sync(dispatch_get_main_queue(), ^{ + [m_Context setFullScreen]; + [m_Context update]; + }); [m_Context makeCurrentContext]; if( bChangeVsync ) @@ -639,7 +640,10 @@ void LowLevelWindow_MacOSX::Update() m_CurrentParams.width = g_iWidth; m_CurrentParams.height = g_iHeight; lock.Unlock(); // Unlock before calling ResolutionChanged(). - [m_Context update]; + dispatch_sync(dispatch_get_main_queue(), ^{ + [m_Context update]; + }); + DISPLAY->ResolutionChanged(); }