mirror of
https://github.com/reactos/reactos.git
synced 2025-01-06 06:20:13 +00:00
[Win32k]
- co_IntSendMessageWithCallBack: Insert the message into the messagequeue before attempting to wake the queue. Probably fixes bug 5580. - Remove the use of MSQ_SENTNOWAIT that was used to determine if messagequeues needed dereferencing. Instead use the SenderQueue member of the message. - Do not close the NewMessagesHandle member of the messagequeue in IntDereferenceMessageQueue. The last reference on a messagequeue could be released by a thread belonging to a process other than the on that created the handle. Also the creating process could already be long gone. Instead close this handle in MsqDestroyMessageQueue which is in the thread/process that created the handle. Problem noticed by smiley. - Revert change done in 51254. James you are indeed correct. Testing shows that the WM_PARENTNOTIFY message is not sent when the program is exiting. svn path=/trunk/; revision=51275
This commit is contained in:
parent
07de2df4a2
commit
0a6bb0f70d
4 changed files with 23 additions and 25 deletions
|
@ -6,7 +6,6 @@
|
|||
#define MSQ_NORMAL 0
|
||||
#define MSQ_ISHOOK 1
|
||||
#define MSQ_ISEVENT 2
|
||||
#define MSQ_SENTNOWAIT 0x80000000
|
||||
|
||||
#define QSIDCOUNTS 6
|
||||
|
||||
|
@ -277,8 +276,6 @@ VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PVOID pWindow); /* F*(&$ headers,
|
|||
DPRINT("Free message queue 0x%x\n", (MsgQueue)); \
|
||||
if ((MsgQueue)->NewMessages != NULL) \
|
||||
ObDereferenceObject((MsgQueue)->NewMessages); \
|
||||
if ((MsgQueue)->NewMessagesHandle != NULL) \
|
||||
ZwClose((MsgQueue)->NewMessagesHandle); \
|
||||
ExFreePoolWithTag((MsgQueue), USERTAG_Q); \
|
||||
} \
|
||||
} while(0)
|
||||
|
|
|
@ -1483,13 +1483,13 @@ co_IntSendMessageWithCallBack( HWND hWnd,
|
|||
IntReferenceMessageQueue(Window->head.pti->MessageQueue);
|
||||
Message->CompletionCallback = CompletionCallback;
|
||||
Message->CompletionCallbackContext = CompletionCallbackContext;
|
||||
Message->HookMessage = MSQ_NORMAL | MSQ_SENTNOWAIT;
|
||||
Message->HookMessage = MSQ_NORMAL;
|
||||
Message->HasPackedLParam = (lParamBufferSize > 0);
|
||||
|
||||
Message->QS_Flags = QS_SENDMESSAGE;
|
||||
MsqWakeQueue(Window->head.pti->MessageQueue, QS_SENDMESSAGE, FALSE);
|
||||
|
||||
InsertTailList(&Window->head.pti->MessageQueue->SentMessagesListHead, &Message->ListEntry);
|
||||
MsqWakeQueue(Window->head.pti->MessageQueue, QS_SENDMESSAGE, TRUE);
|
||||
|
||||
IntDereferenceMessageQueue(Window->head.pti->MessageQueue);
|
||||
|
||||
RETURN(TRUE);
|
||||
|
|
|
@ -479,7 +479,7 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
|
|||
RemoveEntryList(&Message->ListEntry);
|
||||
|
||||
/* remove the message from the dispatching list if needed, so lock the sender's message queue */
|
||||
if (!(Message->HookMessage & MSQ_SENTNOWAIT))
|
||||
if (Message->SenderQueue)
|
||||
{
|
||||
if (Message->DispatchingListEntry.Flink != NULL)
|
||||
{
|
||||
|
@ -523,8 +523,8 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
|
|||
Result);
|
||||
}
|
||||
|
||||
/* Only if it is not a no wait message */
|
||||
if (!(Message->HookMessage & MSQ_SENTNOWAIT))
|
||||
/* Only if the message has a sender was the queue referenced */
|
||||
if (Message->SenderQueue)
|
||||
{
|
||||
IntDereferenceMessageQueue(Message->SenderQueue);
|
||||
IntDereferenceMessageQueue(MessageQueue);
|
||||
|
@ -588,8 +588,8 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow)
|
|||
RemoveEntryList(&SentMessage->ListEntry);
|
||||
ClearMsgBitsMask(MessageQueue, SentMessage->QS_Flags);
|
||||
|
||||
/* remove the message from the dispatching list if neede */
|
||||
if ((!(SentMessage->HookMessage & MSQ_SENTNOWAIT))
|
||||
/* Only if the message has a sender was the queue referenced */
|
||||
if ((SentMessage->SenderQueue)
|
||||
&& (SentMessage->DispatchingListEntry.Flink != NULL))
|
||||
{
|
||||
RemoveEntryList(&SentMessage->DispatchingListEntry);
|
||||
|
@ -607,8 +607,8 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow)
|
|||
ExFreePool((PVOID)SentMessage->Msg.lParam);
|
||||
}
|
||||
|
||||
/* Only if it is not a no wait message */
|
||||
if (!(SentMessage->HookMessage & MSQ_SENTNOWAIT))
|
||||
/* Only if the message has a sender was the queue referenced */
|
||||
if (SentMessage->SenderQueue)
|
||||
{
|
||||
/* dereference our and the sender's message queue */
|
||||
IntDereferenceMessageQueue(MessageQueue);
|
||||
|
@ -1451,9 +1451,8 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
|||
ListEntry);
|
||||
|
||||
DPRINT("Notify the sender and remove a message from the queue that had not been dispatched\n");
|
||||
|
||||
/* remove the message from the dispatching list if needed */
|
||||
if ((!(CurrentSentMessage->HookMessage & MSQ_SENTNOWAIT))
|
||||
/* Only if the message has a sender was the queue referenced */
|
||||
if ((CurrentSentMessage->SenderQueue)
|
||||
&& (CurrentSentMessage->DispatchingListEntry.Flink != NULL))
|
||||
{
|
||||
RemoveEntryList(&CurrentSentMessage->DispatchingListEntry);
|
||||
|
@ -1471,8 +1470,8 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
|||
ExFreePool((PVOID)CurrentSentMessage->Msg.lParam);
|
||||
}
|
||||
|
||||
/* Only if it is not a no wait message */
|
||||
if (!(CurrentSentMessage->HookMessage & MSQ_SENTNOWAIT))
|
||||
/* Only if the message has a sender was the queue referenced */
|
||||
if (CurrentSentMessage->SenderQueue)
|
||||
{
|
||||
/* dereference our and the sender's message queue */
|
||||
IntDereferenceMessageQueue(MessageQueue);
|
||||
|
@ -1511,8 +1510,8 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
|||
ExFreePool((PVOID)CurrentSentMessage->Msg.lParam);
|
||||
}
|
||||
|
||||
/* Only if it is not a no wait message */
|
||||
if (!(CurrentSentMessage->HookMessage & MSQ_SENTNOWAIT))
|
||||
/* Only if the message has a sender was the queue referenced */
|
||||
if (CurrentSentMessage->SenderQueue)
|
||||
{
|
||||
/* dereference our and the sender's message queue */
|
||||
IntDereferenceMessageQueue(MessageQueue);
|
||||
|
@ -1592,6 +1591,9 @@ MsqDestroyMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
|||
/* clean it up */
|
||||
MsqCleanupMessageQueue(MessageQueue);
|
||||
|
||||
if (MessageQueue->NewMessagesHandle != NULL)
|
||||
ZwClose(MessageQueue->NewMessagesHandle);
|
||||
MessageQueue->NewMessagesHandle = NULL;
|
||||
/* decrease the reference counter, if it hits zero, the queue will be freed */
|
||||
IntDereferenceMessageQueue(MessageQueue);
|
||||
}
|
||||
|
|
|
@ -1531,11 +1531,10 @@ static void IntSendParentNotify( PWND pWindow, UINT msg )
|
|||
{
|
||||
USER_REFERENCE_ENTRY Ref;
|
||||
UserRefObjectCo(pWindow->spwndParent, &Ref);
|
||||
// Should be co_IntSendMessage please retest, Ref to Chg, revision 51254...
|
||||
co_IntSendMessageNoWait( pWindow->spwndParent->head.h,
|
||||
WM_PARENTNOTIFY,
|
||||
MAKEWPARAM( msg, pWindow->IDMenu),
|
||||
(LPARAM)pWindow->head.h );
|
||||
co_IntSendMessage( pWindow->spwndParent->head.h,
|
||||
WM_PARENTNOTIFY,
|
||||
MAKEWPARAM( msg, pWindow->IDMenu),
|
||||
(LPARAM)pWindow->head.h );
|
||||
UserDerefObjectCo(pWindow->spwndParent);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue