* lock playHandle mutex in mixer::clear()

* moved implementation of mixer::removePlayHandle() from header to source-file
* only delete play-handle in mixer::removePlayHandle() if it was found in playHandle vector (fixes crash when previewing a preset under high load)



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1698 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-09-23 10:45:05 +00:00
parent eb2f5e9cc2
commit 4583e48c3d
2 changed files with 31 additions and 25 deletions

View File

@@ -243,31 +243,7 @@ public:
return( FALSE );
}
void removePlayHandle( playHandle * _ph )
{
// check thread affinity as we must not delete play-handles
// which were created in a thread different than mixer thread
if( _ph->affinityMatters() &&
_ph->affinity() == QThread::currentThread() )
{
lockPlayHandles();
playHandleVector::iterator it =
qFind( m_playHandles.begin(),
m_playHandles.end(), _ph );
if( it != m_playHandles.end() )
{
m_playHandles.erase( it );
}
unlockPlayHandles();
delete _ph;
}
else
{
lockPlayHandlesToRemove();
m_playHandlesToRemove.push_back( _ph );
unlockPlayHandlesToRemove();
}
}
void removePlayHandle( playHandle * _ph );
inline playHandleVector & playHandles( void )
{