Author: jimtabor
Date: Sat Aug 18 21:40:49 2012
New Revision: 57101
URL:
http://svn.reactos.org/svn/reactos?rev=57101&view=rev
Log:
[NtUser] - Stop spurious window handle errors and code fixes.
Modified:
trunk/reactos/win32ss/user/ntuser/caret.c
Modified: trunk/reactos/win32ss/user/ntuser/caret.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/caret.…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/caret.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/caret.c [iso-8859-1] Sat Aug 18 21:40:49 2012
@@ -42,14 +42,17 @@
if(!ThreadQueue || !ThreadQueue->CaretInfo)
return FALSE;
- pWnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd);
co_IntHideCaret(ThreadQueue->CaretInfo);
ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0;
ThreadQueue->CaretInfo->hWnd = (HWND)0;
ThreadQueue->CaretInfo->Size.cx = ThreadQueue->CaretInfo->Size.cy = 0;
ThreadQueue->CaretInfo->Showing = 0;
ThreadQueue->CaretInfo->Visible = 0;
- IntNotifyWinEvent(EVENT_OBJECT_DESTROY, pWnd, OBJID_CARET, CHILDID_SELF, 0);
+ if (ThreadQueue->CaretInfo->hWnd)
+ {
+ pWnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd);
+ IntNotifyWinEvent(EVENT_OBJECT_DESTROY, pWnd, OBJID_CARET, CHILDID_SELF, 0);
+ }
return TRUE;
}
@@ -90,7 +93,7 @@
ThreadQueue->CaretInfo->Pos.x = X;
ThreadQueue->CaretInfo->Pos.y = Y;
co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER,
0);
- IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd),
IDCARETTIMER, gpsi->dtCaretBlink, NULL, TMRF_SYSTEM);
+ IntSetTimer(pWnd, IDCARETTIMER, gpsi->dtCaretBlink, NULL, TMRF_SYSTEM);
IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_CARET, CHILDID_SELF,
0);
}
return TRUE;
@@ -179,8 +182,8 @@
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
{
PTHREADINFO pti;
- PWND pWnd;
- PUSER_MESSAGE_QUEUE ThreadQueue;
+ PUSER_MESSAGE_QUEUE ThreadQueue;
+ PWND pWnd = NULL;
if (Window) ASSERT_REFS_CO(Window);
@@ -199,16 +202,16 @@
return FALSE;
}
- if(!ThreadQueue->CaretInfo->Visible)
+ if(!ThreadQueue->CaretInfo->Visible &&
ThreadQueue->CaretInfo->hWnd)
{
ThreadQueue->CaretInfo->Visible = 1;
- if(!ThreadQueue->CaretInfo->Showing)
+ pWnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd);
+ if (!ThreadQueue->CaretInfo->Showing)
{
- pWnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd);
co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER,
0);
IntNotifyWinEvent(EVENT_OBJECT_SHOW, pWnd, OBJID_CARET, OBJID_CARET, 0);
}
- IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd), IDCARETTIMER,
gpsi->dtCaretBlink, NULL, TMRF_SYSTEM);
+ IntSetTimer(pWnd, IDCARETTIMER, gpsi->dtCaretBlink, NULL, TMRF_SYSTEM);
}
return TRUE;
}
@@ -248,8 +251,7 @@
if (ThreadQueue->CaretInfo->Visible)
{
- PWND pwnd = UserGetWindowObject(hWnd);
- IntKillTimer(pwnd, IDCARETTIMER, TRUE);
+ IntKillTimer(Window, IDCARETTIMER, TRUE);
co_IntHideCaret(ThreadQueue->CaretInfo);
}