Skip to content

Commit

Permalink
add a check for DDSCAPS_OWNDC
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Oct 18, 2024
1 parent 9671d81 commit a4f927b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ddsurface.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,8 @@ HRESULT dds_GetDC(IDirectDrawSurfaceImpl* This, HDC FAR* lpHDC)
if (lpHDC)
*lpHDC = dc;

InterlockedExchange((LONG*)&This->dc_state, SaveDC(dc));
if (!(This->caps & DDSCAPS_OWNDC))
InterlockedExchange((LONG*)&This->dc_state, SaveDC(dc));

return DD_OK;
}
Expand Down Expand Up @@ -1025,7 +1026,8 @@ HRESULT dds_ReleaseDC(IDirectDrawSurfaceImpl* This, HDC hDC)
}
}

RestoreDC(hDC, InterlockedExchangeAdd((LONG*)&This->dc_state, 0));
if (!(This->caps & DDSCAPS_OWNDC))
RestoreDC(hDC, InterlockedExchangeAdd((LONG*)&This->dc_state, 0));

return DD_OK;
}
Expand Down

0 comments on commit a4f927b

Please sign in to comment.