sdlayer.cpp: fix software renderer crash affecting Mapster32 due to improper handling of lockcount in videoBeginDrawing()/videoEndDrawing() when using glsurface

git-svn-id: https://svn.eduke32.com/eduke32@6933 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2018-06-28 02:00:42 +00:00
parent 9e90b0633b
commit 29c2863750

View file

@ -1733,10 +1733,15 @@ void videoBeginDrawing(void)
modechange = 0;
return;
}
else if (!nogl)
{
if (offscreenrendering) return;
// lock the frame
if (lockcount++ > 0)
return;
if (offscreenrendering) return;
if (!nogl)
{
frameplace = (intptr_t)glsurface_getBuffer();
if (modechange)
{
@ -1747,12 +1752,6 @@ void videoBeginDrawing(void)
return;
}
// lock the frame
if (lockcount++ > 0)
return;
if (offscreenrendering) return;
if (SDL_MUSTLOCK(sdl_buffersurface)) SDL_LockSurface(sdl_buffersurface);
frameplace = (intptr_t)sdl_buffersurface->pixels;
@ -1772,7 +1771,7 @@ void videoBeginDrawing(void)
//
void videoEndDrawing(void)
{
if (bpp > 8 || !nogl)
if (bpp > 8)
{
if (!offscreenrendering) frameplace = 0;
return;
@ -1784,7 +1783,7 @@ void videoEndDrawing(void)
if (lockcount == 0) return;
lockcount = 0;
if (offscreenrendering) return;
if (offscreenrendering || !nogl) return;
if (SDL_MUSTLOCK(sdl_buffersurface)) SDL_UnlockSurface(sdl_buffersurface);
}