Author: tkreuzer
Date: Wed Apr 1 21:32:06 2009
New Revision: 40319
URL:
http://svn.reactos.org/svn/reactos?rev=40319&view=rev
Log:
Implement delayed deletion of gdi objects. This is quite hacky and not 100% correct, but
should hopefully fix the "Too many objects for process!!!" problem for now.
Modified:
trunk/reactos/subsystems/win32/win32k/include/gdiobj.h
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/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] Wed Apr 1
21:32:06 2009
@@ -54,7 +54,10 @@
enum BASEFLAGS
{
- BASEFLAG_LOOKASIDE = 0x80
+ BASEFLAG_LOOKASIDE = 0x80,
+
+ /* ReactOS specific: */
+ BASEFLAG_READY_TO_DIE = 0x1000
};
BOOL INTERNAL_CALL GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle);
@@ -103,8 +106,14 @@
FORCEINLINE
GDIOBJ_ShareUnlockObjByPtr(POBJ Object)
{
+ HGDIOBJ hobj = Object->hHmgr;
+ USHORT flags = Object->BaseFlags;
INT cLocks = InterlockedDecrement((PLONG)&Object->ulShareCount);
ASSERT(cLocks >= 0);
+ if ((flags & BASEFLAG_READY_TO_DIE) && (cLocks == 0))
+ {
+ GDIOBJ_FreeObjByHandle(hobj, GDI_OBJECT_TYPE_DONTCARE);
+ }
return cLocks;
}
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Wed Apr 1
21:32:06 2009
@@ -574,6 +574,7 @@
}
else if (Object->ulShareCount != 0)
{
+ Object->BaseFlags |= BASEFLAG_READY_TO_DIE;
DPRINT("Object %p, ulShareCount = %d\n", Object->hHmgr,
Object->ulShareCount);
GDIDBG_TRACECALLER();
GDIDBG_TRACESHARELOCKER(GDI_HANDLE_GET_INDEX(hObj));