Commit ae3fbab8 authored by Ulrich Weigand's avatar Ulrich Weigand Committed by Alexandre Julliard

Bugfix: always clear QS_... from *both* changeBits and waitBits.

Bugfix: queue->hSendingTask is *queue* handle, not task handle.
parent d604eb12
...@@ -608,7 +608,6 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg, ...@@ -608,7 +608,6 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg,
if( !(queue->wakeBits & QS_SMPARAMSFREE) ) if( !(queue->wakeBits & QS_SMPARAMSFREE) )
{ {
TRACE(sendmsg,"\tIntertask SendMessage: sleeping since unreplied SendMessage pending\n"); TRACE(sendmsg,"\tIntertask SendMessage: sleeping since unreplied SendMessage pending\n");
queue->changeBits &= ~QS_SMPARAMSFREE;
QUEUE_WaitBits( QS_SMPARAMSFREE ); QUEUE_WaitBits( QS_SMPARAMSFREE );
} }
...@@ -622,7 +621,7 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg, ...@@ -622,7 +621,7 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg,
queue->hPrevSendingTask = destQ->hSendingTask; queue->hPrevSendingTask = destQ->hSendingTask;
destQ->hSendingTask = GetTaskQueue(0); destQ->hSendingTask = GetTaskQueue(0);
queue->wakeBits &= ~QS_SMPARAMSFREE; QUEUE_ClearWakeBit( queue, QS_SMPARAMSFREE );
queue->flags = (queue->flags & ~(QUEUE_SM_WIN32|QUEUE_SM_UNICODE)) | flags; queue->flags = (queue->flags & ~(QUEUE_SM_WIN32|QUEUE_SM_UNICODE)) | flags;
TRACE(sendmsg,"%*ssm: smResultInit = %08x\n", prevSMRL, "", (unsigned)&qCtrl); TRACE(sendmsg,"%*ssm: smResultInit = %08x\n", prevSMRL, "", (unsigned)&qCtrl);
...@@ -637,11 +636,7 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg, ...@@ -637,11 +636,7 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg,
{ {
if (!(queue->wakeBits & QS_SMRESULT)) if (!(queue->wakeBits & QS_SMRESULT))
{ {
queue->changeBits &= ~QS_SMRESULT; if (THREAD_IsWin16( THREAD_Current() )) DirectedYield( destQ->hTask );
if (THREAD_IsWin16( THREAD_Current() ))
DirectedYield( destQ->hTask );
else
QUEUE_Signal( destQ->hTask );
QUEUE_WaitBits( QS_SMRESULT ); QUEUE_WaitBits( QS_SMRESULT );
TRACE(sendmsg,"\tsm: have result!\n"); TRACE(sendmsg,"\tsm: have result!\n");
} }
...@@ -653,7 +648,7 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg, ...@@ -653,7 +648,7 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg,
queue->smResult->lResult = queue->SendMessageReturn; queue->smResult->lResult = queue->SendMessageReturn;
queue->smResult->bPending = FALSE; queue->smResult->bPending = FALSE;
} }
queue->wakeBits &= ~QS_SMRESULT; QUEUE_ClearWakeBit( queue, QS_SMRESULT );
if( queue->smResult != &qCtrl ) if( queue->smResult != &qCtrl )
ERR(sendmsg, "%*ssm: weird scenes inside the goldmine!\n", prevSMRL, ""); ERR(sendmsg, "%*ssm: weird scenes inside the goldmine!\n", prevSMRL, "");
...@@ -703,7 +698,7 @@ void WINAPI ReplyMessage16( LRESULT result ) ...@@ -703,7 +698,7 @@ void WINAPI ReplyMessage16( LRESULT result )
queue->InSendMessageHandle = 0; queue->InSendMessageHandle = 0;
QUEUE_SetWakeBit( senderQ, QS_SMRESULT ); QUEUE_SetWakeBit( senderQ, QS_SMRESULT );
if (THREAD_IsWin16(THREAD_Current())) DirectedYield( queue->hSendingTask ); if (THREAD_IsWin16(THREAD_Current())) DirectedYield( senderQ->hTask );
} }
......
...@@ -361,10 +361,7 @@ void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue ) ...@@ -361,10 +361,7 @@ void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue )
{ TRACE(msg,"\trcm: nothing to do\n"); return; } { TRACE(msg,"\trcm: nothing to do\n"); return; }
if( !senderQ->hPrevSendingTask ) if( !senderQ->hPrevSendingTask )
{ QUEUE_ClearWakeBit( queue, QS_SENDMESSAGE ); /* no more sent messages */
queue->wakeBits &= ~QS_SENDMESSAGE; /* no more sent messages */
queue->changeBits &= ~QS_SENDMESSAGE;
}
/* Save current state on stack */ /* Save current state on stack */
prevSender = queue->InSendMessageHandle; prevSender = queue->InSendMessageHandle;
...@@ -445,7 +442,8 @@ void QUEUE_FlushMessages( HQUEUE16 hQueue ) ...@@ -445,7 +442,8 @@ void QUEUE_FlushMessages( HQUEUE16 hQueue )
TRACE(msg,"\tfrom queue %04x, smResult %08x\n", queue->hSendingTask, (unsigned)CtrlPtr ); TRACE(msg,"\tfrom queue %04x, smResult %08x\n", queue->hSendingTask, (unsigned)CtrlPtr );
if( !(queue->hSendingTask = senderQ->hPrevSendingTask) ) if( !(queue->hSendingTask = senderQ->hPrevSendingTask) )
queue->wakeBits &= ~QS_SENDMESSAGE; QUEUE_ClearWakeBit( queue, QS_SENDMESSAGE );
QUEUE_SetWakeBit( senderQ, QS_SMPARAMSFREE ); QUEUE_SetWakeBit( senderQ, QS_SMPARAMSFREE );
queue->smResultCurrent = CtrlPtr; queue->smResultCurrent = CtrlPtr;
......
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