diff --git a/include/track.h b/include/track.h index aa57b4798..79e12c02e 100644 --- a/include/track.h +++ b/include/track.h @@ -327,6 +327,10 @@ private: friend class trackView; + +signals: + void trackRemovalScheduled( trackView * _t ); + } ; diff --git a/include/track_container_view.h b/include/track_container_view.h index 83ce13f5c..2d05935e2 100644 --- a/include/track_container_view.h +++ b/include/track_container_view.h @@ -117,6 +117,7 @@ public: public slots: void realignTracks( void ); void createTrackView( track * _t ); + void deleteTrackView( trackView * _tv ); protected: diff --git a/src/core/track.cpp b/src/core/track.cpp index 06689662a..5a92e402f 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -1115,6 +1115,12 @@ trackOperationsWidget::trackOperationsWidget( trackView * _parent ) : SIGNAL( positionChanged( const midiTime & ) ), this, SLOT( update() ) ); } + + connect( this, SIGNAL( trackRemovalScheduled( trackView * ) ), + m_trackView->getTrackContainerView(), + SLOT( deleteTrackView( trackView * ) ), + Qt::QueuedConnection ); + } @@ -1216,11 +1222,7 @@ void trackOperationsWidget::cloneTrack( void ) void trackOperationsWidget::removeTrack( void ) { - m_trackView->close(); - delete m_trackView; - engine::getMixer()->lock(); - delete m_trackView->getTrack(); - engine::getMixer()->unlock(); + emit trackRemovalScheduled( m_trackView ); } diff --git a/src/gui/track_container_view.cpp b/src/gui/track_container_view.cpp index d565316d6..ee55aa31d 100644 --- a/src/gui/track_container_view.cpp +++ b/src/gui/track_container_view.cpp @@ -216,6 +216,19 @@ void trackContainerView::createTrackView( track * _t ) +void trackContainerView::deleteTrackView( trackView * _tv ) +{ + removeTrackView( _tv ); + delete _tv; + + engine::getMixer()->lock(); + delete _tv->getTrack(); + engine::getMixer()->unlock(); +} + + + + const trackView * trackContainerView::trackViewAt( const int _y ) const { const int abs_y = _y + m_scrollArea->viewport()->y();