mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 15:52:57 +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)
|
#define GDIOBJFLAG_IGNORELOCK (0x2)
|
||||||
|
|
||||||
BOOL FASTCALL NtGdiDeleteObject(HGDIOBJ hObject);
|
BOOL FASTCALL NtGdiDeleteObject(HGDIOBJ hObject);
|
||||||
|
BOOL FASTCALL IsObjectDead(HGDIOBJ);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -703,14 +703,9 @@ DceFreeDCE(PDCE pdce, BOOLEAN Force)
|
||||||
if(Force && !GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, pdce->hDC))
|
if(Force && !GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, pdce->hDC))
|
||||||
{
|
{
|
||||||
DPRINT1("Change ownership for DCE!\n");
|
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(!IsObjectDead((HGDIOBJ) pdce->hDC))
|
||||||
if ((Entry->Type & ~GDI_ENTRY_REUSE_MASK) != 0 && Entry->KernelData != NULL)
|
|
||||||
{
|
|
||||||
DC_SetOwnership( pdce->hDC, PsGetCurrentProcess());
|
DC_SetOwnership( pdce->hDC, PsGetCurrentProcess());
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1("Attempted to change ownership of an DCEhDC 0x%x currently being destroyed!!!\n",pdce->hDC);
|
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_FreeDC(HDC DCToFree)
|
||||||
{
|
{
|
||||||
DC_FreeDcAttr(DCToFree);
|
DC_FreeDcAttr(DCToFree);
|
||||||
INT Index = GDI_HANDLE_GET_INDEX(DCToFree);
|
if(!IsObjectDead( DCToFree ))
|
||||||
PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index];
|
|
||||||
if ((Entry->Type & ~GDI_ENTRY_REUSE_MASK) != 0 && Entry->KernelData != NULL)
|
|
||||||
{
|
{
|
||||||
if (!GDIOBJ_FreeObj(GdiHandleTable, DCToFree, GDI_OBJECT_TYPE_DC))
|
if (!GDIOBJ_FreeObj(GdiHandleTable, DCToFree, GDI_OBJECT_TYPE_DC))
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,10 @@ NTAPI
|
||||||
KeRosDumpStackFrames(
|
KeRosDumpStackFrames(
|
||||||
PULONG Frame,
|
PULONG Frame,
|
||||||
ULONG FrameCount
|
ULONG FrameCount
|
||||||
);
|
)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#define GDI_ENTRY_TO_INDEX(ht, e) \
|
#define GDI_ENTRY_TO_INDEX(ht, e) \
|
||||||
(((ULONG_PTR)(e) - (ULONG_PTR)&((ht)->Entries[0])) / sizeof(GDI_TABLE_ENTRY))
|
(((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);
|
Function, hObj, Entry->Type);
|
||||||
}
|
}
|
||||||
KeRosDumpStackFrames(NULL, 20);
|
KeRosDumpStackFrames(NULL, 20);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -658,6 +660,23 @@ LockHandle:
|
||||||
return FALSE;
|
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
|
* Delete GDI object
|
||||||
* \param hObject object handle
|
* \param hObject object handle
|
||||||
|
@ -668,10 +687,7 @@ FASTCALL
|
||||||
NtGdiDeleteObject(HGDIOBJ hObject)
|
NtGdiDeleteObject(HGDIOBJ hObject)
|
||||||
{
|
{
|
||||||
DPRINT("NtGdiDeleteObject handle 0x%08x\n", hObject);
|
DPRINT("NtGdiDeleteObject handle 0x%08x\n", hObject);
|
||||||
INT Index = GDI_HANDLE_GET_INDEX(hObject);
|
if(!IsObjectDead(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
|
return NULL != hObject
|
||||||
? GDIOBJ_FreeObj(GdiHandleTable, hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE;
|
? GDIOBJ_FreeObj(GdiHandleTable, hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue