[NtUser] - Stop spurious window handle errors and code fixes.

svn path=/trunk/; revision=57101
This commit is contained in:
James Tabor 2012-08-18 21:40:49 +00:00
parent 81198c59dd
commit d2eab1cda4

View file

@ -42,14 +42,17 @@ co_IntDestroyCaret(PTHREADINFO Win32Thread)
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 @@ co_IntSetCaretPos(int X, int Y)
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_UserHideCaret(PWND Window OPTIONAL)
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
{
PTHREADINFO pti;
PWND pWnd;
PUSER_MESSAGE_QUEUE ThreadQueue;
PWND pWnd = NULL;
if (Window) ASSERT_REFS_CO(Window);
@ -199,16 +202,16 @@ BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
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 @@ NtUserCreateCaret(
if (ThreadQueue->CaretInfo->Visible)
{
PWND pwnd = UserGetWindowObject(hWnd);
IntKillTimer(pwnd, IDCARETTIMER, TRUE);
IntKillTimer(Window, IDCARETTIMER, TRUE);
co_IntHideCaret(ThreadQueue->CaretInfo);
}