Follow up to #4959: Lock gdi_UpdateSurfaces like xf_UpdateSurfaces

This commit is contained in:
Armin Novak 2018-12-04 16:56:22 +01:00
parent d260d4e29e
commit 0c13c3199e
2 changed files with 14 additions and 10 deletions

View File

@ -162,7 +162,6 @@ UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y,
RECTANGLE_16 intersection;
UINT16* pSurfaceIds = NULL;
RdpgfxClientContext* context = xfc->context.gdi->gfx;
EnterCriticalSection(&context->mux);
invalidRect.left = x;
invalidRect.top = y;
invalidRect.right = x + width;
@ -172,6 +171,8 @@ UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y,
if (status != CHANNEL_RC_OK)
goto fail;
EnterCriticalSection(&context->mux);
for (index = 0; index < count; index++)
{
surface = (xfGfxSurface*) context->GetSurfaceData(context, pSurfaceIds[index]);
@ -198,13 +199,13 @@ UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y,
}
free(pSurfaceIds);
LeaveCriticalSection(&context->mux);
IFCALLRET(context->UpdateSurfaces, status, context);
if (status != CHANNEL_RC_OK)
goto fail;
fail:
LeaveCriticalSection(&context->mux);
return status;
}

View File

@ -167,6 +167,7 @@ static UINT gdi_UpdateSurfaces(RdpgfxClientContext* context)
if (!gdi->graphicsReset)
return CHANNEL_RC_OK;
EnterCriticalSection(&context->mux);
context->GetSurfaceIds(context, &pSurfaceIds, &count);
status = CHANNEL_RC_OK;
@ -184,6 +185,7 @@ static UINT gdi_UpdateSurfaces(RdpgfxClientContext* context)
}
free(pSurfaceIds);
LeaveCriticalSection(&context->mux);
return status;
}
@ -965,16 +967,15 @@ static UINT gdi_SolidFill(RdpgfxClientContext* context,
if (status != CHANNEL_RC_OK)
goto fail;
LeaveCriticalSection(&context->mux);
if (!gdi->inGfxFrame)
{
status = CHANNEL_RC_NOT_INITIALIZED;
IFCALLRET(context->UpdateSurfaces, status, context);
}
if (status != CHANNEL_RC_OK)
goto fail;
status = CHANNEL_RC_OK;
return status;
fail:
LeaveCriticalSection(&context->mux);
return status;
@ -1042,16 +1043,15 @@ static UINT gdi_SurfaceToSurface(RdpgfxClientContext* context,
goto fail;
}
LeaveCriticalSection(&context->mux);
if (!gdi->inGfxFrame)
{
status = CHANNEL_RC_NOT_INITIALIZED;
IFCALLRET(context->UpdateSurfaces, status, context);
if (status != CHANNEL_RC_OK)
goto fail;
}
status = CHANNEL_RC_OK;
return status;
fail:
LeaveCriticalSection(&context->mux);
return status;
@ -1152,6 +1152,8 @@ static UINT gdi_CacheToSurface(RdpgfxClientContext* context,
goto fail;
}
LeaveCriticalSection(&context->mux);
if (!gdi->inGfxFrame)
{
status = CHANNEL_RC_NOT_INITIALIZED;
@ -1160,6 +1162,7 @@ static UINT gdi_CacheToSurface(RdpgfxClientContext* context,
else
status = CHANNEL_RC_OK;
return status;
fail:
LeaveCriticalSection(&context->mux);
return status;