mirror of
https://github.com/reactos/reactos.git
synced 2025-07-30 21:51:47 +00:00
Add IsObjectDead call and fixed the exceptions in gdiobj.
svn path=/trunk/; revision=30583
This commit is contained in:
parent
3d30146033
commit
cc020a45fb
4 changed files with 26 additions and 16 deletions
|
@ -94,5 +94,6 @@ PVOID INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCES
|
|||
#define GDIOBJFLAG_IGNORELOCK (0x2)
|
||||
|
||||
BOOL FASTCALL NtGdiDeleteObject(HGDIOBJ hObject);
|
||||
BOOL FASTCALL IsObjectDead(HGDIOBJ);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -703,14 +703,9 @@ DceFreeDCE(PDCE pdce, BOOLEAN Force)
|
|||
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);
|
||||
|
|
|
@ -2433,9 +2433,7 @@ VOID FASTCALL
|
|||
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))
|
||||
{
|
||||
|
|
|
@ -33,7 +33,10 @@ NTAPI
|
|||
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 @@ LockErrorDebugOutput(HGDIOBJ hObj, PGDI_TABLE_ENTRY Entry, LPSTR Function)
|
|||
Function, hObj, Entry->Type);
|
||||
}
|
||||
KeRosDumpStackFrames(NULL, 20);
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -658,6 +660,23 @@ LockHandle:
|
|||
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 @@ FASTCALL
|
|||
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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue