From 57d80a50d5ed17d511e01d10e6b85f21137dd78f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Wed, 16 Jun 2010 18:47:04 +0000 Subject: [PATCH] [WIN32k] - Chek if there is something to do in GDIOBJ_SetOwnership before doing it svn path=/trunk/; revision=47788 --- .../subsystems/win32/win32k/objects/gdiobj.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/reactos/subsystems/win32/win32k/objects/gdiobj.c b/reactos/subsystems/win32/win32k/objects/gdiobj.c index e2771e43ee3..66937461359 100644 --- a/reactos/subsystems/win32/win32k/objects/gdiobj.c +++ b/reactos/subsystems/win32/win32k/objects/gdiobj.c @@ -1412,6 +1412,19 @@ LockHandle: PPROCESSINFO W32Process; NTSTATUS Status; + if (NewOwner != NULL) + { + ProcessId = PsGetProcessId(NewOwner); + } + else + ProcessId = 0; + + if((ULONG_PTR)ProcessId == ((ULONG_PTR)PrevProcId & ~0x1)) + { + DPRINT("Setting same process than previous one, nothing to do\n"); + goto done; + } + /* dereference the process' object counter */ /* FIXME */ if ((ULONG_PTR)PrevProcId & ~0x1) @@ -1430,8 +1443,6 @@ LockHandle: if (NewOwner != NULL) { - ProcessId = PsGetProcessId(NewOwner); - /* Increase the new process' object counter */ W32Process = (PPROCESSINFO)NewOwner->Win32Process; if (W32Process != NULL) @@ -1439,9 +1450,8 @@ LockHandle: InterlockedIncrement(&W32Process->GDIHandleCount); } } - else - ProcessId = 0; + done: /* remove the process id lock and change it to the new process id */ (void)InterlockedExchangePointer((PVOID*)&Entry->ProcessId, ProcessId); -- 2.17.1