Commit 179e8deb authored by Francis Beaudet's avatar Francis Beaudet Committed by Alexandre Julliard

Check if DC is busy before deleting it.

parent 99920819
...@@ -53,5 +53,6 @@ extern void DCE_FreeWindowDCE( WND* ); ...@@ -53,5 +53,6 @@ extern void DCE_FreeWindowDCE( WND* );
extern INT16 DCE_ExcludeRgn( HDC, WND*, HRGN ); extern INT16 DCE_ExcludeRgn( HDC, WND*, HRGN );
extern HRGN DCE_GetVisRgn( HWND, WORD, HWND, WORD ); extern HRGN DCE_GetVisRgn( HWND, WORD, HWND, WORD );
extern BOOL DCE_InvalidateDCE( WND*, const RECT* ); extern BOOL DCE_InvalidateDCE( WND*, const RECT* );
extern BOOL DCE_IsDCBusy(HDC hdc);
#endif /* __WINE_DCE_H */ #endif /* __WINE_DCE_H */
...@@ -657,7 +657,20 @@ BOOL16 WINAPI DeleteDC16( HDC16 hdc ) ...@@ -657,7 +657,20 @@ BOOL16 WINAPI DeleteDC16( HDC16 hdc )
*/ */
BOOL WINAPI DeleteDC( HDC 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; if (!dc) return FALSE;
TRACE(dc, "%04x\n", hdc ); TRACE(dc, "%04x\n", hdc );
......
...@@ -628,6 +628,35 @@ INT16 DCE_ExcludeRgn( HDC hDC, WND* wnd, HRGN hRgn ) ...@@ -628,6 +628,35 @@ INT16 DCE_ExcludeRgn( HDC hDC, WND* wnd, HRGN hRgn )
} }
/*********************************************************************** /***********************************************************************
* 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) * GetDCEx16 (USER.359)
*/ */
HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags ) HDC16 WINAPI GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment