AudioFileProcessor Segmentation fault when loading in reversed samples
szeli1 opened this issue · comments
When a project is loaded and an audio file processor track is clicked with the reverse option turned on, a segmentation fault happens.
OS:
Linux Mint 21.3 x86_64
Steps to reproduce
Make a new project.
Import a sample and reverse it.
Save and close the project.
Load the project again.
Click the audio file processor track.
Expected behavior
The instrument opens without issue.
Actual behavior
When the track is clicked a segmentation fault happens
Affected LMMS versions
LMMS master
Logs
Click to expand
QtXmlWrapper::loadXMLfile(): empty data Segmentation fault (core dumped)
Full stack trace - Click to expand
``` QWeakPointer::internalData(const QWeakPointer * const this) (/usr/include/qt/QtCore/qsharedpointer_impl.h:704) QPointer::data(const QPointer * const this) (/usr/include/qt/QtCore/qpointer.h:77) QPointer::operator lmms::Model*(const QPointer * const this) (/usr/include/qt/QtCore/qpointer.h:83) lmms::gui::ModelView::model(lmms::gui::ModelView * const this) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/include/ModelView.h:45) lmms::gui::ModelView::castModel(lmms::gui::ModelView * const this) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/include/ModelView.h:56) lmms::gui::TypedModelView::model(lmms::gui::TypedModelView * const this) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/include/AutomatableModelView.h:126) libaudiofileprocessor.so!lmms::gui::AudioFileProcessorWaveView::knob::slideBy(lmms::gui::AudioFileProcessorWaveView::knob * const this, double v, bool check_bound) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/plugins/AudioFileProcessor/AudioFileProcessorWaveView.h:90) libaudiofileprocessor.so!lmms::gui::AudioFileProcessorWaveView::slideSampleByFrames(lmms::gui::AudioFileProcessorWaveView * const this, lmms::f_cnt_t frames) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp:477) libaudiofileprocessor.so!lmms::gui::AudioFileProcessorWaveView::reverse(lmms::gui::AudioFileProcessorWaveView * const this) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp:485) libaudiofileprocessor.so!lmms::gui::AudioFileProcessorWaveView::updateGraph(lmms::gui::AudioFileProcessorWaveView * const this) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp:318) libaudiofileprocessor.so!lmms::gui::AudioFileProcessorWaveView::update(lmms::gui::AudioFileProcessorWaveView * const this) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/plugins/AudioFileProcessor/AudioFileProcessorWaveView.h:108) libaudiofileprocessor.so!lmms::gui::AudioFileProcessorWaveView::AudioFileProcessorWaveView(lmms::gui::AudioFileProcessorWaveView * const this, QWidget * parent, int w, int h, const lmms::Sample * buf) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp:91) libaudiofileprocessor.so!lmms::gui::AudioFileProcessorView::newWaveView(lmms::gui::AudioFileProcessorView * const this) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/plugins/AudioFileProcessor/AudioFileProcessorView.cpp:187) libaudiofileprocessor.so!lmms::gui::AudioFileProcessorView::AudioFileProcessorView(lmms::gui::AudioFileProcessorView * const this, lmms::Instrument * instrument, QWidget * parent) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/plugins/AudioFileProcessor/AudioFileProcessorView.cpp:141) libaudiofileprocessor.so!lmms::AudioFileProcessor::instantiateView(lmms::AudioFileProcessor * const this, QWidget * _parent) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/plugins/AudioFileProcessor/AudioFileProcessor.cpp:303) lmms::Plugin::createView(lmms::Plugin * const this, QWidget * parent) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/src/core/Plugin.cpp:266) lmms::gui::InstrumentTrackWindow::updateInstrumentView(lmms::gui::InstrumentTrackWindow * const this) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/src/gui/instrument/InstrumentTrackWindow.cpp:467) lmms::gui::InstrumentTrackWindow::InstrumentTrackWindow(lmms::gui::InstrumentTrackWindow * const this, lmms::gui::InstrumentTrackView * _itv) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/src/gui/instrument/InstrumentTrackWindow.cpp:296) lmms::gui::InstrumentTrackView::getInstrumentTrackWindow(lmms::gui::InstrumentTrackView * const this) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/src/gui/tracks/InstrumentTrackView.cpp:257) lmms::gui::InstrumentTrackView::toggleInstrumentWindow(lmms::gui::InstrumentTrackView * const this, bool _on) (/home/michael/Eigene Dateien/Development/LMMS/lmms-dev-mg/lmms/src/gui/tracks/InstrumentTrackView.cpp:311) ```
The problem is that in the call to AudioFileProcessorWaveView::slideSampleByFrames
the three knob
members are all nullptr
because for some reason there is an explicit setter for them instead of passing them directly in the constructor. Due to the setter they are passed in too late and the constructor already triggers code which needs them.
I also wonder if it is not a problem in the first place that the knobs are given to the AudioFileProcessorWaveView
instead of their models.
the three
knob
members are allnullptr
Is this related to #6958 ?
This PR has at least introduced the code where it crashes. I currently have a branch in the works where the problem is fixed by moving the knob initialization into the constructor.
Pull request #7124 fixes the problem.