mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-19 12:16:16 -04:00
Proposed fix for 1352 Instrument crash on loading
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "Track.h"
|
||||
#include "JournallingObject.h"
|
||||
#include "InstrumentTrack.h"
|
||||
|
||||
|
||||
class QVBoxLayout;
|
||||
@@ -182,6 +183,23 @@ signals:
|
||||
|
||||
} ;
|
||||
|
||||
class InstrumentLoaderThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
InstrumentLoaderThread( QObject *parent = 0 , InstrumentTrack *it = 0, QString name = "" );
|
||||
|
||||
void run();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
InstrumentTrack *m_it;
|
||||
QString m_name;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
#include "Track.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TrackContainerView::TrackContainerView( TrackContainer * _tc ) :
|
||||
QWidget(),
|
||||
ModelView( NULL, this ),
|
||||
@@ -325,7 +328,8 @@ void TrackContainerView::dropEvent( QDropEvent * _de )
|
||||
InstrumentTrack * it = dynamic_cast<InstrumentTrack *>(
|
||||
Track::create( Track::InstrumentTrack,
|
||||
m_tc ) );
|
||||
it->loadInstrument( value );
|
||||
InstrumentLoaderThread *ilt = new InstrumentLoaderThread( this, it, value);
|
||||
ilt->start();
|
||||
//it->toggledInstrumentTrackButton( true );
|
||||
_de->accept();
|
||||
}
|
||||
@@ -450,6 +454,19 @@ void TrackContainerView::scrollArea::wheelEvent( QWheelEvent * _we )
|
||||
}
|
||||
}
|
||||
|
||||
InstrumentLoaderThread::InstrumentLoaderThread( QObject *parent, InstrumentTrack *it, QString name) : QThread( parent )
|
||||
{
|
||||
m_it = it;
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
void InstrumentLoaderThread::run()
|
||||
{
|
||||
m_it->loadInstrument( m_name );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user