From 0027666c4eaa7c97f11db5f1f3589ee8311a34e9 Mon Sep 17 00:00:00 2001 From: Julius Michaelis Date: Sat, 13 Jan 2018 12:29:24 +0100 Subject: [PATCH] Fix for #1813 / #1956 --- src/graphics/C4DrawGL.cpp | 4 ++++ src/graphics/C4Surface.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/graphics/C4DrawGL.cpp b/src/graphics/C4DrawGL.cpp index 41d4904a5..371c50254 100644 --- a/src/graphics/C4DrawGL.cpp +++ b/src/graphics/C4DrawGL.cpp @@ -357,6 +357,10 @@ CStdGLCtx *CStdGL::CreateContext(C4Window * pWindow, C4AbstractApp *pApp) } // creation selected the new context - switch back to previous context RenderTarget = nullptr; +#ifdef WITH_QT_EDITOR + // FIXME This is a hackfix for #1813 / #1956. The proper way to fix them would probably be to select a drawing context before invoking C4Player::FinalInit + if (!app->isEditor) +#endif pCurrCtx = nullptr; // done return pCtx; diff --git a/src/graphics/C4Surface.cpp b/src/graphics/C4Surface.cpp index 844f5293d..127f1f4e6 100644 --- a/src/graphics/C4Surface.cpp +++ b/src/graphics/C4Surface.cpp @@ -511,7 +511,7 @@ DWORD C4Surface::GetPixDw(int iX, int iY, bool fApplyModulation) { // get+lock affected texture if (!texture) return 0; - texture->Lock(); + assert(texture->Lock()); pBuf=(BYTE *) texture->texLock.pBits.get(); iPitch=texture->texLock.Pitch; }