From b99692729ca2f0d46a0409cba67d0d997972969e Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 3 Oct 2014 05:26:01 +0200 Subject: [PATCH] * Only allow one settings dialog at a time. --- src/tomahawk/TomahawkWindow.cpp | 11 ++++++++--- src/tomahawk/TomahawkWindow.h | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/tomahawk/TomahawkWindow.cpp b/src/tomahawk/TomahawkWindow.cpp index fa74ddd07..cd75caf8b 100644 --- a/src/tomahawk/TomahawkWindow.cpp +++ b/src/tomahawk/TomahawkWindow.cpp @@ -1000,10 +1000,15 @@ TomahawkWindow::onHistoryForwardAvailable( bool avail ) void TomahawkWindow::showSettingsDialog() { - SettingsDialog* settingsDialog = new SettingsDialog; - connect( settingsDialog, SIGNAL( finished( bool ) ), settingsDialog, SLOT( deleteLater() ) ); + if ( m_settingsDialog ) + return; - settingsDialog->show(); + m_settingsDialog = new SettingsDialog; + // This needs to be a QueuedConnection, so that deleteLater() actually works. + connect( m_settingsDialog.data(), SIGNAL( finished( bool ) ), + m_settingsDialog.data(), SLOT( deleteLater() ), Qt::QueuedConnection ); + + m_settingsDialog->show(); } diff --git a/src/tomahawk/TomahawkWindow.h b/src/tomahawk/TomahawkWindow.h index c98a6057d..bea75b942 100644 --- a/src/tomahawk/TomahawkWindow.h +++ b/src/tomahawk/TomahawkWindow.h @@ -56,12 +56,12 @@ class QSearchField; class SourceTreeView; class QAction; +class SettingsDialog; class MusicScanner; class AudioControls; class TomahawkTrayIcon; class PlaylistModel; class AnimatedSplitter; - class AccountsToolButton; namespace Ui @@ -179,6 +179,7 @@ private: #endif Ui::TomahawkWindow* ui; + QPointer m_settingsDialog; QSearchField* m_searchWidget; AudioControls* m_audioControls; TomahawkTrayIcon* m_trayIcon;