Fix crash in Audio File Processor (#7124)

* Fix crash in Audio File Processor

Fix a crash in the Audio File Processor that occurs when an Audio File Processor with a reversed sample is loaded from a save file and then the plugin window is opened.

The problem was caused by a call to `AudioFileProcessorWaveView::slideSampleByFrames` during the execution of constructor of `AudioFileProcessorWaveView`. In that situation the three `knob` members were all `nullptr` because for some reason there was an explicit setter for them which was only called after construction. This is fixed by passing and setting the knobs in the constructor.

Another question is if it's not a problem in the first place that the knobs are given to the `AudioFileProcessorWaveView` instead of their underlying models.
This commit is contained in:
Michael Gregorius
2024-02-24 11:05:54 +01:00
committed by GitHub
parent d4ae82283b
commit 03d067b105
3 changed files with 25 additions and 24 deletions

View File

@@ -184,12 +184,12 @@ void AudioFileProcessorView::newWaveView()
delete m_waveView;
m_waveView = 0;
}
m_waveView = new AudioFileProcessorWaveView(this, 245, 75, &castModel<AudioFileProcessor>()->sample());
m_waveView->move(2, 172);
m_waveView->setKnobs(
m_waveView = new AudioFileProcessorWaveView(this, 245, 75, &castModel<AudioFileProcessor>()->sample(),
dynamic_cast<AudioFileProcessorWaveView::knob*>(m_startKnob),
dynamic_cast<AudioFileProcessorWaveView::knob*>(m_endKnob),
dynamic_cast<AudioFileProcessorWaveView::knob*>(m_loopKnob));
m_waveView->move(2, 172);
m_waveView->show();
}