From 82055a9bddf419f1c38ddceb6e3c607c2a87eb67 Mon Sep 17 00:00:00 2001 From: Fastigium Date: Mon, 14 Mar 2016 13:59:28 +0100 Subject: [PATCH] Use deleteLater() on the FxLine when deleting a channel to prevent a crash In Qt, it is not safe to delete a QObject inside a signal emitted by that QObject. This happened with FxLine when removing an FX channel using the context menu. This commit changes that by using deleteLater() instead of delete on the FxLine. It also hides the FxLine to prevent a ghost of it being drawn when deleting the last non-master FX channel. --- src/gui/FxMixerView.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/FxMixerView.cpp b/src/gui/FxMixerView.cpp index 5826ed9d4..eb20cafa1 100644 --- a/src/gui/FxMixerView.cpp +++ b/src/gui/FxMixerView.cpp @@ -382,7 +382,9 @@ void FxMixerView::deleteChannel(int index) delete m_fxChannelViews[index]->m_fader; delete m_fxChannelViews[index]->m_muteBtn; delete m_fxChannelViews[index]->m_soloBtn; - delete m_fxChannelViews[index]->m_fxLine; + // delete fxLine later to prevent a crash when deleting from context menu + m_fxChannelViews[index]->m_fxLine->hide(); + m_fxChannelViews[index]->m_fxLine->deleteLater(); delete m_fxChannelViews[index]->m_rackView; delete m_fxChannelViews[index]; m_channelAreaWidget->adjustSize();