[hxcommon] Re: [hxclidev] [hxclient] CR needed: fix for HX Issue #428
Greg Wright gwright at real.comFrom: "Erik Hodge" <ehodge at real.com> > This fixes HX Issue # 428, the seg fault that happened in release > builds of splay at the end of playing a .rm (RA), .rm (RV), or .mp3. > The diff is not too readable, but all it does is wrap the call > to [HXSimpleList].RemoveHead() inside a check to make sure the list > isn't empty. RemoveHead() does not do such a check. Why this is > crashing now and (apparently) wasn't a problem before is still an > issue that needs resolving. I will discuss with GregW when he gets > back. We should never get into a case where the semaphore count is not the same as the message que count. Something is truly wrong if that is the case. Looking at the code I think the problem lies in our PeekMessage and PeekMessageMatching methods. If someone calls this function with the 'removeMessage' param set to TRUE then we end up removing the message but not decrementing the sem count. This leaves the message que in a bad state. So, I would just try adding something like this and see if it doesn't stop the asserts and crashes: Index: platform/unix/UnixThreads.cpp =================================================================== RCS file: /cvs/common/system/platform/unix/UnixThreads.cpp,v retrieving revision 1.5 diff -u -w -r1.5 UnixThreads.cpp --- platform/unix/UnixThreads.cpp 20 May 2003 01:49:35 -0000 1.5 +++ platform/unix/UnixThreads.cpp 14 Jul 2003 22:07:54 -0000 @@ -423,6 +423,10 @@ if(listpos) { m_messageQue.RemoveAt(listpos); + //There was at least one message in the que, + //decrement the count before unlocking the que. + m_pSemMessageCount->Wait(); + } HX_DELETE( pMsgTmp ); } @@ -468,6 +472,9 @@ if( bRemoveMessage ) { pMsgTmp = (HXThreadMessage*)m_messageQue.RemoveHead(); + //There was at least one message in the que, + //decrement the count before unlocking the que. + m_pSemMessageCount->Wait(); } else { --greg. > > > Index: UnixThreads.cpp > =================================================================== > RCS file: /cvs/common/system/platform/unix/UnixThreads.cpp,v > retrieving revision 1.2 > diff -u -r1.2 UnixThreads.cpp > --- UnixThreads.cpp 15 Jan 2003 00:04:33 -0000 1.2 > +++ UnixThreads.cpp 11 Jul 2003 22:41:53 -0000 > @@ -345,21 +345,25 @@ > //Sanity check. > HX_ASSERT( !m_messageQue.IsEmpty() ); > > - HXThreadMessage* pMsgTmp = > (HXThreadMessage*)m_messageQue.RemoveHead(); > - if( pMsgTmp != NULL ) > + if (!m_messageQue.IsEmpty()) > { > - pMsg->m_ulMessage = pMsgTmp->m_ulMessage; > - pMsg->m_pParam1 = pMsgTmp->m_pParam1; > - pMsg->m_pParam2 = pMsgTmp->m_pParam2; > - pMsg->m_pPlatformSpecificData = pMsgTmp->m_pPlatformSpecificData; > + HXThreadMessage* pMsgTmp = > (HXThreadMessage*)m_messageQue.RemoveHead(); > + if( pMsgTmp != NULL ) > + { > + pMsg->m_ulMessage = pMsgTmp->m_ulMessage; > + pMsg->m_pParam1 = pMsgTmp->m_pParam1; > + pMsg->m_pParam2 = pMsgTmp->m_pParam2; > + pMsg->m_pPlatformSpecificData = > pMsgTmp->m_pPlatformSpecificData; > > - //free it. > - HX_DELETE( pMsgTmp ); > - } > - else > - { > - HX_ASSERT( "que panic" == NULL ); > + //free it. > + HX_DELETE( pMsgTmp ); > + } > + else > + { > + HX_ASSERT( "que panic" == NULL ); > + } > } > + > m_pmtxQue->Unlock(); > } > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe at helix-client.helixcommunity.org > For additional commands, e-mail: dev-help at helix-client.helixcommunity.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe at common.helixcommunity.org For additional commands, e-mail: dev-help at common.helixcommunity.org