mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 20:21:22 +00:00
[win32k]
- When message are sent without waiting a reply (non-queued messages) the message queues are referenced and dereferenced in the call. Message removal and cleanup functions for queues expected a reference on the queue. Add checks to determine if the message is a non-queued message and if so release memory for those that had pointers and more importantly skip dereferencing the queues. Possibly fixes random crashes and memory leaks. svn path=/trunk/; revision=47142
This commit is contained in:
parent
330de811a7
commit
786f5a19d7
1 changed files with 39 additions and 10 deletions
|
@ -1072,7 +1072,7 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow)
|
||||||
{
|
{
|
||||||
DPRINT("Notify the sender and remove a message from the queue that had not been dispatched\n");
|
DPRINT("Notify the sender and remove a message from the queue that had not been dispatched\n");
|
||||||
|
|
||||||
RemoveEntryList(&SentMessage->ListEntry);
|
RemoveEntryList(&SentMessage->ListEntry);
|
||||||
|
|
||||||
/* remove the message from the dispatching list */
|
/* remove the message from the dispatching list */
|
||||||
if(SentMessage->DispatchingListEntry.Flink != NULL)
|
if(SentMessage->DispatchingListEntry.Flink != NULL)
|
||||||
|
@ -1086,9 +1086,19 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow)
|
||||||
KeSetEvent(SentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
KeSetEvent(SentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dereference our and the sender's message queue */
|
if (SentMessage->HasPackedLParam == TRUE)
|
||||||
IntDereferenceMessageQueue(MessageQueue);
|
{
|
||||||
IntDereferenceMessageQueue(SentMessage->SenderQueue);
|
if (SentMessage->Msg.lParam)
|
||||||
|
ExFreePool((PVOID)SentMessage->Msg.lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Only if it is not a no wait message */
|
||||||
|
if (!(SentMessage->HookMessage & MSQ_SENTNOWAIT))
|
||||||
|
{
|
||||||
|
/* dereference our and the sender's message queue */
|
||||||
|
IntDereferenceMessageQueue(MessageQueue);
|
||||||
|
IntDereferenceMessageQueue(SentMessage->SenderQueue);
|
||||||
|
}
|
||||||
|
|
||||||
/* free the message */
|
/* free the message */
|
||||||
ExFreePool(SentMessage);
|
ExFreePool(SentMessage);
|
||||||
|
@ -1509,9 +1519,19 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
||||||
KeSetEvent(CurrentSentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
KeSetEvent(CurrentSentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dereference our and the sender's message queue */
|
if (CurrentSentMessage->HasPackedLParam == TRUE)
|
||||||
IntDereferenceMessageQueue(MessageQueue);
|
{
|
||||||
IntDereferenceMessageQueue(CurrentSentMessage->SenderQueue);
|
if (CurrentSentMessage->Msg.lParam)
|
||||||
|
ExFreePool((PVOID)CurrentSentMessage->Msg.lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Only if it is not a no wait message */
|
||||||
|
if (!(CurrentSentMessage->HookMessage & MSQ_SENTNOWAIT))
|
||||||
|
{
|
||||||
|
/* dereference our and the sender's message queue */
|
||||||
|
IntDereferenceMessageQueue(MessageQueue);
|
||||||
|
IntDereferenceMessageQueue(CurrentSentMessage->SenderQueue);
|
||||||
|
}
|
||||||
|
|
||||||
/* free the message */
|
/* free the message */
|
||||||
ExFreePool(CurrentSentMessage);
|
ExFreePool(CurrentSentMessage);
|
||||||
|
@ -1547,10 +1567,19 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
||||||
KeSetEvent(CurrentSentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
KeSetEvent(CurrentSentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dereference our and the sender's message queue */
|
if (CurrentSentMessage->HasPackedLParam == TRUE)
|
||||||
IntDereferenceMessageQueue(MessageQueue);
|
{
|
||||||
IntDereferenceMessageQueue(CurrentSentMessage->SenderQueue);
|
if (CurrentSentMessage->Msg.lParam)
|
||||||
|
ExFreePool((PVOID)CurrentSentMessage->Msg.lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Only if it is not a no wait message */
|
||||||
|
if (!(CurrentSentMessage->HookMessage & MSQ_SENTNOWAIT))
|
||||||
|
{
|
||||||
|
/* dereference our and the sender's message queue */
|
||||||
|
IntDereferenceMessageQueue(MessageQueue);
|
||||||
|
IntDereferenceMessageQueue(CurrentSentMessage->SenderQueue);
|
||||||
|
}
|
||||||
/* free the message */
|
/* free the message */
|
||||||
ExFreePool(CurrentSentMessage);
|
ExFreePool(CurrentSentMessage);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue