added dummyTrackContainer with dummyInstrumentTrack in order to have a default-model for cached inactive instrument-track-windows - fixes regular crashes

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@863 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-04-01 22:31:10 +00:00
parent 108f3a9a68
commit c2dbbd7fe0
8 changed files with 90 additions and 11 deletions

View File

@@ -58,6 +58,7 @@ pianoRoll * engine::s_pianoRoll = NULL;
projectNotes * engine::s_projectNotes = NULL;
projectJournal * engine::s_projectJournal = NULL;
ladspa2LMMS * engine::s_ladspaManager = NULL;
dummyTrackContainer * engine::s_dummyTC = NULL;
QMap<QString, QString> engine::s_sampleExtensions;
@@ -97,6 +98,7 @@ void engine::init( const bool _has_gui )
}
presetPreviewPlayHandle::init();
s_dummyTC = new dummyTrackContainer;
s_mixer->startProcessing();
}
@@ -121,15 +123,21 @@ void engine::destroy( void )
delete s_fxMixerView;
s_fxMixerView = NULL;
delete s_fxMixer;
s_fxMixer = NULL;
presetPreviewPlayHandle::cleanup();
instrumentTrackView::cleanupWindowPool();
delete s_song;
delete s_bbTrackContainer;
delete s_dummyTC;
delete s_ladspaManager;
presetPreviewPlayHandle::cleanUp();
delete s_mixer;
s_mixer = NULL;
delete s_fxMixer;
s_fxMixer = NULL;
//delete configManager::inst();
delete s_projectJournal;
s_projectJournal = NULL;

View File

@@ -196,7 +196,7 @@ void presetPreviewPlayHandle::init( void )
void presetPreviewPlayHandle::cleanUp( void )
void presetPreviewPlayHandle::cleanup( void )
{
delete s_previewTC;
s_previewTC = NULL;

View File

@@ -24,13 +24,11 @@
*/
#include "track_container.h"
#include <QtGui/QApplication>
#include <QtGui/QProgressDialog>
#include "track_container.h"
#include "instrument_track.h"
#include "engine.h"
#include "song.h"
@@ -203,5 +201,21 @@ void trackContainer::setMutedOfAllTracks( bool _muted )
dummyTrackContainer::dummyTrackContainer( void ) :
trackContainer(),
m_dummyInstrumentTrack( NULL )
{
setJournalling( FALSE );
m_dummyInstrumentTrack = dynamic_cast<instrumentTrack *>(
track::create( track::InstrumentTrack,
this ) );
m_dummyInstrumentTrack->setJournalling( FALSE );
}
#include "track_container.moc"

View File

@@ -921,6 +921,10 @@ void instrumentTrackView::freeInstrumentTrackWindow( void )
{
if( s_windows.count() < INSTRUMENT_WINDOW_CACHE_SIZE )
{
m_window->setModel(
engine::getDummyTrackContainer()->
dummyInstrumentTrack() );
m_window->parentWidget()->hide();
s_windows.enqueue( m_window );
}
else
@@ -935,6 +939,17 @@ void instrumentTrackView::freeInstrumentTrackWindow( void )
void instrumentTrackView::cleanupWindowPool( void )
{
while( s_windows.count() )
{
delete s_windows.dequeue();
}
}
instrumentTrackWindow * instrumentTrackView::getInstrumentTrackWindow( void )
{
if( m_window != NULL )
@@ -1179,7 +1194,7 @@ instrumentTrackWindow::~instrumentTrackWindow()
void instrumentTrackWindow::modelChanged( void )
{
m_track = m_itv->model();
m_track = castModel<instrumentTrack>();
m_instrumentNameLE->setText( m_track->name() );