check type of preview-play-handle via type() instead of blindly using dynamic_cast - probably fixes random crashes when previewing a lot of samples and presets

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@925 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-04-15 22:32:44 +00:00
parent 536b16088d
commit 53c79c5471
3 changed files with 22 additions and 5 deletions

View File

@@ -536,10 +536,11 @@ void listView::mouseReleaseEvent( QMouseEvent * _me )
{
// if there're samples shorter than 3 seconds, we don't
// stop them if the user releases mouse-button...
samplePlayHandle * s = dynamic_cast<samplePlayHandle *>(
m_previewPlayHandle );
if( s != NULL )
if( m_previewPlayHandle->type() ==
playHandle::SamplePlayHandle )
{
samplePlayHandle * s = dynamic_cast<samplePlayHandle *>(
m_previewPlayHandle );
if( s->totalFrames() - s->framesDone() <=
static_cast<f_cnt_t>(
engine::getMixer()->sampleRate() * 3 ) )