InstrumentTrack: fix FX channel range
Because it is set to INT_MAX by default and never corrected for cloned instruments, it could go over the maximum and cause a segmentation fault.
This commit is contained in:
@@ -871,6 +871,8 @@ void song::createNewProjectFromTemplate( const QString & _template )
|
||||
// load given song
|
||||
void song::loadProject( const QString & _file_name )
|
||||
{
|
||||
QDomNode node;
|
||||
|
||||
m_loadingProject = true;
|
||||
|
||||
clearProject();
|
||||
@@ -912,7 +914,19 @@ void song::loadProject( const QString & _file_name )
|
||||
//Backward compatibility for LMMS <= 0.4.15
|
||||
PeakController::initGetControllerBySetting();
|
||||
|
||||
QDomNode node = dataFile.content().firstChild();
|
||||
// Load mixer first to be able to set the correct range for FX channels
|
||||
node = dataFile.content().firstChildElement( engine::fxMixer()->nodeName() );
|
||||
if( !node.isNull() )
|
||||
{
|
||||
engine::fxMixer()->restoreState( node.toElement() );
|
||||
if( engine::hasGUI() )
|
||||
{
|
||||
// refresh FxMixerView
|
||||
engine::fxMixerView()->refreshDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
node = dataFile.content().firstChild();
|
||||
while( !node.isNull() )
|
||||
{
|
||||
if( node.isElement() )
|
||||
@@ -925,15 +939,6 @@ void song::loadProject( const QString & _file_name )
|
||||
{
|
||||
restoreControllerStates( node.toElement() );
|
||||
}
|
||||
else if( node.nodeName() == engine::fxMixer()->nodeName() )
|
||||
{
|
||||
engine::fxMixer()->restoreState( node.toElement() );
|
||||
if( engine::hasGUI() )
|
||||
{
|
||||
// refresh FxMixerView
|
||||
engine::fxMixerView()->refreshDisplay();
|
||||
}
|
||||
}
|
||||
else if( engine::hasGUI() )
|
||||
{
|
||||
if( node.nodeName() == engine::getControllerRackView()->nodeName() )
|
||||
|
||||
@@ -703,7 +703,7 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & thisElement
|
||||
m_panningModel.loadSettings( thisElement, "pan" );
|
||||
m_pitchRangeModel.loadSettings( thisElement, "pitchrange" );
|
||||
m_pitchModel.loadSettings( thisElement, "pitch" );
|
||||
m_effectChannelModel.setRange( 0, INT_MAX );
|
||||
m_effectChannelModel.setRange( 0, engine::fxMixer()->numChannels()-1 );
|
||||
m_effectChannelModel.loadSettings( thisElement, "fxch" );
|
||||
m_baseNoteModel.loadSettings( thisElement, "basenote" );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user