Skip to content
Snippets Groups Projects
Commit 179e8deb authored by Francis Beaudet's avatar Francis Beaudet Committed by Alexandre Julliard
Browse files

Check if DC is busy before deleting it.

parent 99920819
No related branches found
No related tags found
No related merge requests found
......@@ -53,5 +53,6 @@ extern void DCE_FreeWindowDCE( WND* );
extern INT16 DCE_ExcludeRgn( HDC, WND*, HRGN );
extern HRGN DCE_GetVisRgn( HWND, WORD, HWND, WORD );
extern BOOL DCE_InvalidateDCE( WND*, const RECT* );
extern BOOL DCE_IsDCBusy(HDC hdc);
#endif /* __WINE_DCE_H */
......@@ -657,7 +657,20 @@ BOOL16 WINAPI DeleteDC16( HDC16 hdc )
*/
BOOL WINAPI DeleteDC( HDC hdc )
{
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
DC * dc;
/*
* Windows will not let you delete a DC that is busy
* (between GetDC and ReleaseDC)
*/
if (DCE_IsDCBusy(hdc))
{
WARN(dc, " Application trying to delete a busy DC\n");
return TRUE;
}
dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE;
TRACE(dc, "%04x\n", hdc );
......
......@@ -627,6 +627,35 @@ INT16 DCE_ExcludeRgn( HDC hDC, WND* wnd, HRGN hRgn )
return ExtSelectClipRgn( hDC, hRgn, RGN_DIFF );
}
/***********************************************************************
* DCE_IsDCBusy
*
* Utility function to determine if a particular DC is currently
* in a busy state..
*/
BOOL DCE_IsDCBusy(HDC hdc)
{
DCE* dce;
BOOL isBusy = FALSE;
WIN_LockWnds();
dce = firstDCE;
while (dce && (dce->hDC != hdc)) dce = dce->next;
if ( dce )
{
if ( dce->DCXflags & DCX_DCEBUSY )
{
isBusy = TRUE;
}
}
WIN_UnlockWnds();
return isBusy;
}
/***********************************************************************
* GetDCEx16 (USER.359)
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment