- fix one locking ignorant return 0; in MSG_SendMessageInterThread()
- fix a crash in QUEUE_RemoveSMSG()
- convert some queue WARN() to ERR()
- spaileng fikses
diff --git a/windows/input.c b/windows/input.c
index 6ae9788..b8c6d41 100644
--- a/windows/input.c
+++ b/windows/input.c
@@ -463,7 +463,7 @@
/* Get the messageQ for the current thread */
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;
}
diff --git a/windows/message.c b/windows/message.c
index 4371f37..765ee58 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -837,7 +837,10 @@
/* add smsg struct in the pending list of the destination queue */
if (QUEUE_AddSMSG(destQ, SM_PENDING_LIST, smsg) == FALSE)
- return 0;
+ {
+ retVal = 0;
+ goto CLEANUP;
+ }
iWndsLocks = WIN_SuspendWndsLock();
@@ -905,6 +908,7 @@
LeaveCriticalSection( &queue->cSection );
+CLEANUP:
QUEUE_Unlock( queue );
QUEUE_Unlock( destQ );
diff --git a/windows/queue.c b/windows/queue.c
index 34e95ae..4a5408d 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -304,7 +304,7 @@
/***********************************************************************
* 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
* retrieve a pointer on the structure. QUEUE_Unlock should also be called
* when access to the queue structure is not required anymore.
@@ -536,7 +536,7 @@
if (!hQueue || !msgQueue)
{
- WARN_(msg)("invalid argument.\n");
+ ERR_(msg)("invalid argument.\n");
return 0;
}
@@ -567,7 +567,7 @@
if ( !msgQ || (msgQ->magic != QUEUE_MAGIC) )
{
/* 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;
break;
}
@@ -578,7 +578,7 @@
HeapUnlock( SystemHeap );
- /* free up resource used by MESSAGEQUEUE strcture */
+ /* free up resource used by MESSAGEQUEUE structure */
msgQueue->lockCount--;
QUEUE_Unlock( msgQueue );
@@ -791,7 +791,7 @@
}
default:
- WARN_(sendmsg)("Invalid list: %d", list);
+ ERR_(sendmsg)("Invalid list: %d", list);
break;
}
@@ -802,8 +802,8 @@
/***********************************************************************
* QUEUE_RemoveSMSG
*
- * This routine is called when a SMSG need to be remove from one of the three
- * SM list. (SM_PROCESSING_LIST, SM_PENDING_LIST, SM_WAITING_LIST)
+ * This routine is called when a SMSG needs to be removed from one of the three
+ * SM lists (SM_PROCESSING_LIST, SM_PENDING_LIST, SM_WAITING_LIST).
* If smsg == 0, remove the first smsg from the specified list
*/
SMSG *QUEUE_RemoveSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg )
@@ -864,12 +864,12 @@
receiver thread */
EnterCriticalSection( &queue->cSection );
- if (!smsg || !queue->smPending)
+ if (!smsg)
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);
- LeaveCriticalSection( &queue->cSection );
+ LeaveCriticalSection( &queue->cSection );
return 0;
}
@@ -887,7 +887,7 @@
return smsg;
default:
- WARN_(sendmsg)("Invalid list: %d", list);
+ ERR_(sendmsg)("Invalid list: %d", list);
break;
}
@@ -966,7 +966,7 @@
smsg->flags |= SMSG_SENDING_REPLY;
ReplyMessage( result );
- TRACE_(sendmsg)("done! \n" );
+ TRACE_(sendmsg)("done!\n" );
}
@@ -1196,7 +1196,7 @@
if (!mergeMsg)
{
- /* Should I limit the number of message in
+ /* Should I limit the number of messages in
the system message queue??? */
/* Don't merge allocate a new msg in the global heap */
@@ -1250,10 +1250,10 @@
MESSAGEQUEUE *queue = QUEUE_Lock( hQueue );
if (queue)
-{
+ {
hTask = queue->teb->htask16;
QUEUE_Unlock( queue );
-}
+ }
return hTask;
}
@@ -1431,7 +1431,7 @@
/* Create thread message queue */
if( !(hQueue = QUEUE_CreateMsgQueue( TRUE )))
{
- WARN_(msg)("failed!\n");
+ ERR_(msg)("failed!\n");
return FALSE;
}