diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index 9364588190..99b3dc6868 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -277,8 +277,6 @@ void MainWindow::ShowUpdateDialog() if (!m_updateDialog) m_updateDialog = new UpdateDialog(this, m_storage); m_updateDialog->ShowDialog(); - // tell download manager that we're gone... - m_storage.Unsubscribe(); } void MainWindow::ShowClassifPanel() diff --git a/qt/update_dialog.cpp b/qt/update_dialog.cpp index 2a4bbeb4bd..64afdc423c 100644 --- a/qt/update_dialog.cpp +++ b/qt/update_dialog.cpp @@ -85,6 +85,17 @@ namespace qt setWindowTitle(tr("Geographical Regions")); resize(600, 500); + + // we want to receive all download progress and result events + m_storage.Subscribe(bind(&UpdateDialog::OnCountryChanged, this, _1), + bind(&UpdateDialog::OnCountryDownloadProgress, this, _1, _2), + bind(&UpdateDialog::OnUpdateRequest, this, _1, _2)); + } + + UpdateDialog::~UpdateDialog() + { + // tell download manager that we're gone... + m_storage.Unsubscribe(); } /// when user clicks on any map row in the table @@ -361,10 +372,6 @@ namespace qt void UpdateDialog::ShowDialog() { - // we want to receive all download progress and result events - m_storage.Subscribe(bind(&UpdateDialog::OnCountryChanged, this, _1), - bind(&UpdateDialog::OnCountryDownloadProgress, this, _1, _2), - bind(&UpdateDialog::OnUpdateRequest, this, _1, _2)); // if called for first time if (!m_tree->topLevelItemCount()) FillTree(); diff --git a/qt/update_dialog.hpp b/qt/update_dialog.hpp index 8b03754a3d..0ebe0df39a 100644 --- a/qt/update_dialog.hpp +++ b/qt/update_dialog.hpp @@ -17,6 +17,7 @@ namespace qt public: explicit UpdateDialog(QWidget * parent, storage::Storage & storage); + ~UpdateDialog(); /// @name Called from downloader to notify GUI //@{