Clean up DCEs when switching out of graphics mode

svn path=/trunk/; revision=6792
This commit is contained in:
Gé van Geldorp 2003-11-24 21:20:35 +00:00
parent c4f578c98c
commit 5e30da094e
6 changed files with 43 additions and 26 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: handle.c,v 1.13 2003/05/18 17:16:17 ea Exp $
/* $Id: handle.c,v 1.14 2003/11/24 21:20:34 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -81,10 +81,12 @@ PVOID FASTCALL AccessInternalObject(ULONG Handle)
{
PENGOBJ pEngObj;
if( Handle == 0 || Handle >= MAX_GDI_HANDLES ){
DPRINT1("AccessInternalObject: invalid handle: %d!!!!\n", Handle);
return NULL;
}
if (Handle == 0 || Handle >= MAX_GDI_HANDLES
|| GDIHandles[Handle].pEngObj == NULL)
{
DPRINT1("AccessInternalObject: invalid handle: %d!!!!\n", Handle);
return NULL;
}
pEngObj = GDIHandles[Handle].pEngObj;
return (PVOID)pEngObj;
@ -94,10 +96,12 @@ PVOID FASTCALL AccessUserObject(ULONG Handle)
{
PENGOBJ pEngObj;
if( Handle == 0 || Handle >= MAX_GDI_HANDLES ){
DPRINT1("AccessUserObject: invalid handle: %d!!!!\n", Handle);
return NULL;
}
if (Handle == 0 || Handle >= MAX_GDI_HANDLES
|| GDIHandles[Handle].pEngObj == NULL)
{
DPRINT1("AccessUserObject: invalid handle: %d!!!!\n", Handle);
return NULL;
}
pEngObj = GDIHandles[Handle].pEngObj;
return (PVOID)( (PCHAR)pEngObj + sizeof( ENGOBJ ) );

View file

@ -53,5 +53,6 @@ BOOL FASTCALL DCE_InternalDelete(PDCE dce);
HWND FASTCALL IntWindowFromDC(HDC hDc);
PDCE FASTCALL DceFreeDCE(PDCE dce);
void FASTCALL DceFreeWindowDCE(PWINDOW_OBJECT Window);
void FASTCALL DceEmptyCache(void);
#endif /* _WIN32K_DCE_H */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: windc.c,v 1.37 2003/11/20 21:21:29 navaraf Exp $
/* $Id: windc.c,v 1.38 2003/11/24 21:20:35 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -610,7 +610,7 @@ NtUserReleaseDC(HWND hWnd, HDC hDc)
PDCE FASTCALL
DceFreeDCE(PDCE dce)
{
DCE **ppDCE, *ret;
DCE *ret;
HANDLE hDce;
if (NULL == dce)
@ -622,17 +622,7 @@ DceFreeDCE(PDCE dce)
USER_Lock();
#endif
ppDCE = &FirstDce;
while (*ppDCE && (*ppDCE != dce))
{
ppDCE = &(*ppDCE)->next;
}
if (*ppDCE == dce)
{
*ppDCE = dce->next;
}
ret = *ppDCE;
ret = dce->next;
#if 0 /* FIXME */
USER_Unlock();
@ -709,4 +699,13 @@ DceFreeWindowDCE(PWINDOW_OBJECT Window)
}
}
void FASTCALL
DceEmptyCache()
{
while (FirstDce != NULL)
{
DceFreeDCE(FirstDce);
}
}
/* EOF */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: brush.c,v 1.27 2003/10/04 21:09:29 gvg Exp $
/* $Id: brush.c,v 1.28 2003/11/24 21:20:35 gvg Exp $
*/
@ -211,6 +211,11 @@ BOOL STDCALL IntPatBlt(DC *dc,
BOOL ret;
SurfObj = (SURFOBJ*)AccessUserObject((ULONG)dc->Surface);
if (NULL == SurfObj)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
assert(BrushObj);
if (BrushObj->logbrush.lbStyle != BS_NULL)
@ -247,7 +252,8 @@ BOOL STDCALL IntPatBlt(DC *dc,
NULL,
ROP);
}
return(ret);
return ret;
}
BOOL STDCALL NtGdiPolyPatBlt(HDC hDC,

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dc.c,v 1.98 2003/11/17 08:20:24 navaraf Exp $
/* $Id: dc.c,v 1.99 2003/11/24 21:20:35 gvg Exp $
*
* DC.C - Device context functions
*
@ -1929,6 +1929,8 @@ DC_InternalDeleteDC( PDC DCToDelete )
CHECKPOINT;
DCToDelete->DriverFunctions.DisablePDev(DCToDelete->PDev);
DceEmptyCache();
ObDereferenceObject(PrimarySurface.VideoDeviceObject);
PrimarySurfaceCreated = FALSE;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: line.c,v 1.23 2003/08/28 19:41:37 gvg Exp $ */
/* $Id: line.c,v 1.24 2003/11/24 21:20:35 gvg Exp $ */
// Some code from the WINE project source (www.winehq.com)
@ -159,6 +159,11 @@ NtGdiLineTo(HDC hDC,
}
SurfObj = (SURFOBJ*)AccessUserObject ( (ULONG)dc->Surface );
if (NULL == SurfObj)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
if (PATH_IsPathOpen(dc->w.path))
{