From b9f467cd978c873a66a5b16e33d364880d9eef55 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sat, 8 Mar 2008 20:20:06 +0000 Subject: [PATCH] fixed crash when removing TCO via context-menu git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@780 0778d3d1-df1d-0410-868b-ea421aaaa00d --- include/track.h | 1 + src/core/track.cpp | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/track.h b/include/track.h index 08a67e485..96b1eddce 100644 --- a/include/track.h +++ b/include/track.h @@ -161,6 +161,7 @@ public: public slots: virtual bool close( void ); + void remove( void ); protected: diff --git a/src/core/track.cpp b/src/core/track.cpp index 386ea2e72..6e99468d2 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -262,6 +262,16 @@ bool trackContentObjectView::close( void ) +void trackContentObjectView::remove( void ) +{ + // delete ourself + m_trackView->getTrackContentWidget()->removeTCOView( this ); + m_tco->deleteLater(); +} + + + + void trackContentObjectView::updateLength( void ) { if( fixedTCOs() ) @@ -426,10 +436,7 @@ void trackContentObjectView::mousePressEvent( QMouseEvent * _me ) } else if( fixedTCOs() == FALSE ) { - // delete ourself - m_trackView->getTrackContentWidget()-> - removeTCOView( this ); - m_tco->deleteLater(); + remove(); } } } @@ -567,7 +574,7 @@ void trackContentObjectView::contextMenuEvent( QContextMenuEvent * _cme ) { contextMenu.addAction( embed::getIconPixmap( "cancel" ), tr( "Delete (middle mousebutton)" ), - m_tco, SLOT( deleteLater() ) ); + this, SLOT( remove() ) ); contextMenu.addSeparator(); contextMenu.addAction( embed::getIconPixmap( "edit_cut" ), tr( "Cut" ), m_tco, SLOT( cut() ) );