Author: jimtabor Date: Tue Nov 20 08:25:13 2007 New Revision: 30583
URL: http://svn.reactos.org/svn/reactos?rev=30583&view=rev Log: Add IsObjectDead call and fixed the exceptions in gdiobj.
Modified: trunk/reactos/subsystems/win32/win32k/include/gdiobj.h trunk/reactos/subsystems/win32/win32k/ntuser/windc.c trunk/reactos/subsystems/win32/win32k/objects/dc.c trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
Modified: trunk/reactos/subsystems/win32/win32k/include/gdiobj.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h Tue Nov 20 08:25:13 2007 @@ -94,5 +94,6 @@ #define GDIOBJFLAG_IGNORELOCK (0x2)
BOOL FASTCALL NtGdiDeleteObject(HGDIOBJ hObject); +BOOL FASTCALL IsObjectDead(HGDIOBJ);
#endif
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c Tue Nov 20 08:25:13 2007 @@ -703,14 +703,9 @@ if(Force && !GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, pdce->hDC)) { DPRINT1("Change ownership for DCE!\n"); - INT Index = GDI_HANDLE_GET_INDEX(pdce->hDC); - PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; - - // Must take control of handles that are not in the process of going away. - if ((Entry->Type & ~GDI_ENTRY_REUSE_MASK) != 0 && Entry->KernelData != NULL) - { + + if(!IsObjectDead((HGDIOBJ) pdce->hDC)) DC_SetOwnership( pdce->hDC, PsGetCurrentProcess()); - } else { DPRINT1("Attempted to change ownership of an DCEhDC 0x%x currently being destroyed!!!\n",pdce->hDC);
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Tue Nov 20 08:25:13 2007 @@ -2433,9 +2433,7 @@ DC_FreeDC(HDC DCToFree) { DC_FreeDcAttr(DCToFree); - INT Index = GDI_HANDLE_GET_INDEX(DCToFree); - PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; - if ((Entry->Type & ~GDI_ENTRY_REUSE_MASK) != 0 && Entry->KernelData != NULL) + if(!IsObjectDead( DCToFree )) { if (!GDIOBJ_FreeObj(GdiHandleTable, DCToFree, GDI_OBJECT_TYPE_DC)) {
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c Tue Nov 20 08:25:13 2007 @@ -33,7 +33,10 @@ KeRosDumpStackFrames( PULONG Frame, ULONG FrameCount -); +) +{ + return; +}
#define GDI_ENTRY_TO_INDEX(ht, e) \ (((ULONG_PTR)(e) - (ULONG_PTR)&((ht)->Entries[0])) / sizeof(GDI_TABLE_ENTRY)) @@ -328,7 +331,6 @@ Function, hObj, Entry->Type); } KeRosDumpStackFrames(NULL, 20); - }
/*! @@ -658,6 +660,23 @@ return FALSE; }
+BOOL +FASTCALL +IsObjectDead(HGDIOBJ hObject) +{ + INT Index = GDI_HANDLE_GET_INDEX(hObject); + PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; + // We check to see if the objects are knocking on deaths door. + if ((Entry->Type & ~GDI_ENTRY_REUSE_MASK) != 0 && Entry->KernelData != NULL) + return FALSE; + else + { + DPRINT1("Object 0x%x currently being destroyed!!!\n",hObject); + return TRUE; // return true and move on. + } +} + + /*! * Delete GDI object * \param hObject object handle @@ -668,13 +687,10 @@ NtGdiDeleteObject(HGDIOBJ hObject) { DPRINT("NtGdiDeleteObject handle 0x%08x\n", hObject); - INT Index = GDI_HANDLE_GET_INDEX(hObject); - PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index]; - // We check to see if the objects are knocking on deaths door. - if ((Entry->Type & ~GDI_ENTRY_REUSE_MASK) != 0 && Entry->KernelData != NULL) + if(!IsObjectDead(hObject)) { return NULL != hObject - ? GDIOBJ_FreeObj(GdiHandleTable, hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE; + ? GDIOBJ_FreeObj(GdiHandleTable, hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE; } else {