Commit 5e7fa021 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

- fix one locking ignorant return 0; in MSG_SendMessageInterThread()

- fix a crash in QUEUE_RemoveSMSG() - convert some queue WARN() to ERR() - spaileng fikses
parent 2b5d9c6e
...@@ -463,7 +463,7 @@ HWND WINAPI GetCapture(void) ...@@ -463,7 +463,7 @@ HWND WINAPI GetCapture(void)
/* Get the messageQ for the current thread */ /* Get the messageQ for the current thread */
if (!(pCurMsgQ = (MESSAGEQUEUE *)QUEUE_Lock( GetFastQueue16() ))) if (!(pCurMsgQ = (MESSAGEQUEUE *)QUEUE_Lock( GetFastQueue16() )))
{ {
TRACE_(win)("GetCapture32: Current message queue not found. Exiting!\n" ); TRACE_(win)("GetCapture: Current message queue not found. Exiting!\n" );
return 0; return 0;
} }
......
...@@ -837,7 +837,10 @@ static LRESULT MSG_SendMessageInterThread( HQUEUE16 hDestQueue, ...@@ -837,7 +837,10 @@ static LRESULT MSG_SendMessageInterThread( HQUEUE16 hDestQueue,
/* add smsg struct in the pending list of the destination queue */ /* add smsg struct in the pending list of the destination queue */
if (QUEUE_AddSMSG(destQ, SM_PENDING_LIST, smsg) == FALSE) if (QUEUE_AddSMSG(destQ, SM_PENDING_LIST, smsg) == FALSE)
return 0; {
retVal = 0;
goto CLEANUP;
}
iWndsLocks = WIN_SuspendWndsLock(); iWndsLocks = WIN_SuspendWndsLock();
...@@ -905,6 +908,7 @@ got: ...@@ -905,6 +908,7 @@ got:
LeaveCriticalSection( &queue->cSection ); LeaveCriticalSection( &queue->cSection );
CLEANUP:
QUEUE_Unlock( queue ); QUEUE_Unlock( queue );
QUEUE_Unlock( destQ ); QUEUE_Unlock( destQ );
......
...@@ -304,7 +304,7 @@ INT16 PERQDATA_SetCaptureInfo( PERQUEUEDATA *pQData, INT16 nCaptureHT ) ...@@ -304,7 +304,7 @@ INT16 PERQDATA_SetCaptureInfo( PERQUEUEDATA *pQData, INT16 nCaptureHT )
/*********************************************************************** /***********************************************************************
* QUEUE_Lock * QUEUE_Lock
* *
* Function for getting a 32 bit pointer on queue strcture. For thread * Function for getting a 32 bit pointer on queue structure. For thread
* safeness programmers should use this function instead of GlobalLock to * safeness programmers should use this function instead of GlobalLock to
* retrieve a pointer on the structure. QUEUE_Unlock should also be called * retrieve a pointer on the structure. QUEUE_Unlock should also be called
* when access to the queue structure is not required anymore. * when access to the queue structure is not required anymore.
...@@ -536,7 +536,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue ) ...@@ -536,7 +536,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
if (!hQueue || !msgQueue) if (!hQueue || !msgQueue)
{ {
WARN_(msg)("invalid argument.\n"); ERR_(msg)("invalid argument.\n");
return 0; return 0;
} }
...@@ -567,7 +567,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue ) ...@@ -567,7 +567,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
if ( !msgQ || (msgQ->magic != QUEUE_MAGIC) ) if ( !msgQ || (msgQ->magic != QUEUE_MAGIC) )
{ {
/* HQUEUE link list is corrupted, try to exit gracefully */ /* HQUEUE link list is corrupted, try to exit gracefully */
WARN_(msg)("HQUEUE link list corrupted!\n"); ERR_(msg)("HQUEUE link list corrupted!\n");
pPrev = 0; pPrev = 0;
break; break;
} }
...@@ -578,7 +578,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue ) ...@@ -578,7 +578,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
HeapUnlock( SystemHeap ); HeapUnlock( SystemHeap );
/* free up resource used by MESSAGEQUEUE strcture */ /* free up resource used by MESSAGEQUEUE structure */
msgQueue->lockCount--; msgQueue->lockCount--;
QUEUE_Unlock( msgQueue ); QUEUE_Unlock( msgQueue );
...@@ -791,7 +791,7 @@ BOOL QUEUE_AddSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg ) ...@@ -791,7 +791,7 @@ BOOL QUEUE_AddSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg )
} }
default: default:
WARN_(sendmsg)("Invalid list: %d", list); ERR_(sendmsg)("Invalid list: %d", list);
break; break;
} }
...@@ -802,8 +802,8 @@ BOOL QUEUE_AddSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg ) ...@@ -802,8 +802,8 @@ BOOL QUEUE_AddSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg )
/*********************************************************************** /***********************************************************************
* QUEUE_RemoveSMSG * QUEUE_RemoveSMSG
* *
* This routine is called when a SMSG need to be remove from one of the three * This routine is called when a SMSG needs to be removed from one of the three
* SM list. (SM_PROCESSING_LIST, SM_PENDING_LIST, SM_WAITING_LIST) * SM lists (SM_PROCESSING_LIST, SM_PENDING_LIST, SM_WAITING_LIST).
* If smsg == 0, remove the first smsg from the specified list * If smsg == 0, remove the first smsg from the specified list
*/ */
SMSG *QUEUE_RemoveSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg ) SMSG *QUEUE_RemoveSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg )
...@@ -864,9 +864,9 @@ SMSG *QUEUE_RemoveSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg ) ...@@ -864,9 +864,9 @@ SMSG *QUEUE_RemoveSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg )
receiver thread */ receiver thread */
EnterCriticalSection( &queue->cSection ); EnterCriticalSection( &queue->cSection );
if (!smsg || !queue->smPending) if (!smsg)
smsg = queue->smPending; smsg = queue->smPending;
else if ( (smsg != queue->smPending) || !queue->smPending )
{ {
ERR_(sendmsg)("should always remove the top one in Pending list, smsg=0x%p queue=0x%p", smsg, queue); ERR_(sendmsg)("should always remove the top one in Pending list, smsg=0x%p queue=0x%p", smsg, queue);
LeaveCriticalSection( &queue->cSection ); LeaveCriticalSection( &queue->cSection );
...@@ -887,7 +887,7 @@ SMSG *QUEUE_RemoveSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg ) ...@@ -887,7 +887,7 @@ SMSG *QUEUE_RemoveSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg )
return smsg; return smsg;
default: default:
WARN_(sendmsg)("Invalid list: %d", list); ERR_(sendmsg)("Invalid list: %d", list);
break; break;
} }
...@@ -966,7 +966,7 @@ void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue ) ...@@ -966,7 +966,7 @@ void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue )
smsg->flags |= SMSG_SENDING_REPLY; smsg->flags |= SMSG_SENDING_REPLY;
ReplyMessage( result ); ReplyMessage( result );
TRACE_(sendmsg)("done! \n" ); TRACE_(sendmsg)("done!\n" );
} }
...@@ -1196,7 +1196,7 @@ void hardware_event( UINT message, WPARAM wParam, LPARAM lParam, ...@@ -1196,7 +1196,7 @@ void hardware_event( UINT message, WPARAM wParam, LPARAM lParam,
if (!mergeMsg) if (!mergeMsg)
{ {
/* Should I limit the number of message in /* Should I limit the number of messages in
the system message queue??? */ the system message queue??? */
/* Don't merge allocate a new msg in the global heap */ /* Don't merge allocate a new msg in the global heap */
...@@ -1250,10 +1250,10 @@ HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue ) ...@@ -1250,10 +1250,10 @@ HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue )
MESSAGEQUEUE *queue = QUEUE_Lock( hQueue ); MESSAGEQUEUE *queue = QUEUE_Lock( hQueue );
if (queue) if (queue)
{ {
hTask = queue->teb->htask16; hTask = queue->teb->htask16;
QUEUE_Unlock( queue ); QUEUE_Unlock( queue );
} }
return hTask; return hTask;
} }
...@@ -1431,7 +1431,7 @@ HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags ) ...@@ -1431,7 +1431,7 @@ HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags )
/* Create thread message queue */ /* Create thread message queue */
if( !(hQueue = QUEUE_CreateMsgQueue( TRUE ))) if( !(hQueue = QUEUE_CreateMsgQueue( TRUE )))
{ {
WARN_(msg)("failed!\n"); ERR_(msg)("failed!\n");
return FALSE; return FALSE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment