From f15ed8635a726da4d13756dc13173fa40cc548b0 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Thu, 9 Apr 2015 09:09:33 -0400 Subject: [PATCH] gui: Disable Q_NOTIFY_REMOVED for temporary queues Using this notification was causing segmentation faults when Ocarina was closed with at least one temporary queue. I can handle everything I need directly in the GUI without problems, so this notification really isn't necessary. Signed-off-by: Anna Schumaker --- gui/queue.cpp | 17 ++++++++++++----- include/gui/tabs.h | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gui/queue.cpp b/gui/queue.cpp index 879d6296..080c94a1 100644 --- a/gui/queue.cpp +++ b/gui/queue.cpp @@ -64,7 +64,8 @@ private: public: QueueTab(Queue *, unsigned int num); ~QueueTab(); - void on_remove(); + + void on_track_removed(unsigned int); /** * Helper functions @@ -168,17 +169,22 @@ QueueTab :: QueueTab(Queue *pq, unsigned int num) gui :: get_widget("o_notebook")->insert_page(q_vbox, q_tab_box, num); gui :: get_widget("o_notebook")->set_tab_reorderable(q_vbox); q_vbox.show_all(); + tab_pq->unset_flag(Q_NOTIFY_REMOVE); } -QueueTab :: ~QueueTab() {} - -void QueueTab :: on_remove() +QueueTab :: ~QueueTab() { queue_mapping.erase(tab_widget); tab_unmap(); gui :: get_widget("o_notebook")->remove_page(q_vbox); renumber_queues(); - delete this; +} + +void QueueTab :: on_track_removed(unsigned int row) +{ + this->Tab :: on_track_removed(row); + if (tab_pq->size() == 0) + delete this; } @@ -296,6 +302,7 @@ void QueueTab :: queue_set_sensitive(bool sensitive) void QueueTab :: on_close_clicked() { deck :: destroy(tab_pq); + delete this; } void QueueTab :: on_switch_changed() diff --git a/include/gui/tabs.h b/include/gui/tabs.h index b4fdf773..64b13a28 100644 --- a/include/gui/tabs.h +++ b/include/gui/tabs.h @@ -53,9 +53,9 @@ public: /** * QNotifier implementation */ - virtual void on_remove(); + void on_remove(); void on_track_added(unsigned int); - void on_track_removed(unsigned int); + virtual void on_track_removed(unsigned int); void on_track_updated(unsigned int); /**