From f3d94b0e63c05027de9669c6bd024cc72d09b845 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Mon, 22 Sep 2008 15:11:55 +0000 Subject: [PATCH] Improve peak-controller deletion, well, partially git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1683 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 4 ++++ include/peak_controller.h | 2 +- src/core/peak_controller.cpp | 13 +++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0a35930fc..18333cd01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ * plugins/lb302/lb302.cpp: max wave-shape model's max match the new total of wave-shapes. + * include/peak_controller.h: + * src/core/peak_controller.cpp: + delete controller when effect is destroyed, but not the other way around + 2008-09-21 Tobias Doerffel * src/core/plugin.cpp: diff --git a/include/peak_controller.h b/include/peak_controller.h index 9721cfb12..fdd63401c 100644 --- a/include/peak_controller.h +++ b/include/peak_controller.h @@ -59,7 +59,7 @@ public: public slots: virtual controllerDialog * createDialog( QWidget * _parent ); - + void handleDestroyedEffect( ); protected: // The internal per-controller get-value function diff --git a/src/core/peak_controller.cpp b/src/core/peak_controller.cpp index d7eb15fed..a9d7f1678 100644 --- a/src/core/peak_controller.cpp +++ b/src/core/peak_controller.cpp @@ -47,6 +47,8 @@ peakController::peakController( model * _parent, controller( PeakController, _parent, tr( "Peak Controller" ) ), m_peakEffect( _peak_effect ) { + connect( m_peakEffect, SIGNAL( destroyed( ) ), + this, SLOT( handleDestroyedEffect( ) ) ); } @@ -70,6 +72,17 @@ float peakController::value( int _offset ) +void peakController::handleDestroyedEffect( ) +{ + // possible race condition... + printf("disconnecting effect\n"); + disconnect( m_peakEffect ); + m_peakEffect = NULL; + //deleteLater(); + delete this; +} + + void peakController::saveSettings( QDomDocument & _doc, QDomElement & _this ) {