diff --git a/reactos/subsystems/win32/win32k/objects/gdiobj.c b/reactos/subsystems/win32/win32k/objects/gdiobj.c index 87c7dcd6875..73acabd8b6c 100644 --- a/reactos/subsystems/win32/win32k/objects/gdiobj.c +++ b/reactos/subsystems/win32/win32k/objects/gdiobj.c @@ -668,9 +668,19 @@ FASTCALL NtGdiDeleteObject(HGDIOBJ hObject) { DPRINT("NtGdiDeleteObject handle 0x%08x\n", hObject); - - return NULL != hObject - ? GDIOBJ_FreeObj(GdiHandleTable, hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE; + 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 NULL != hObject + ? GDIOBJ_FreeObj(GdiHandleTable, hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE; + } + else + { + DPRINT1("Attempt DeleteObject 0x%x currently being destroyed!!!\n",hObject); + return TRUE; // return true and move on. + } } /*!