diff options
author | vng <viktor.govako@gmail.com> | 2012-05-26 18:08:08 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:39:15 +0300 |
commit | c71f4daa84b62e0a9b30576ac1330d5cb3820d84 (patch) | |
tree | 99402a74aac2b7eae3865c8ecdec7e32a13f2a13 /qt | |
parent | df50c805aebc97a77b32b5189812d17aa45f7f25 (diff) |
[desktop] Fix crash on shutdown. Create and destroy UpdateDialog on demand.
Diffstat (limited to 'qt')
-rw-r--r-- | qt/mainwindow.cpp | 8 | ||||
-rw-r--r-- | qt/mainwindow.hpp | 7 | ||||
-rw-r--r-- | qt/update_dialog.cpp | 8 | ||||
-rw-r--r-- | qt/update_dialog.hpp | 2 |
4 files changed, 7 insertions, 18 deletions
diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index 7436746ce0..1aa9369c94 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -37,9 +37,6 @@ namespace qt { MainWindow::MainWindow() -#ifndef NO_DOWNLOADER - : m_updateDialog(0) -#endif // NO_DOWNLOADER { m_pDrawWidget = new DrawWidget(this); m_locationService.reset(CreateDesktopLocationService(*this)); @@ -368,9 +365,8 @@ void MainWindow::OnPreferences() #ifndef NO_DOWNLOADER void MainWindow::ShowUpdateDialog() { - if (!m_updateDialog) - m_updateDialog = new UpdateDialog(this, m_pDrawWidget->GetFramework().Storage()); - m_updateDialog->ShowDialog(); + UpdateDialog dlg(this, m_pDrawWidget->GetFramework().Storage()); + dlg.ShowModal(); } void MainWindow::ShowClassifPanel() diff --git a/qt/mainwindow.hpp b/qt/mainwindow.hpp index 38f9511b15..9ff7d65048 100644 --- a/qt/mainwindow.hpp +++ b/qt/mainwindow.hpp @@ -6,6 +6,7 @@ #include <QtGui/QMainWindow> + class QDockWidget; namespace search { class Result; } @@ -13,7 +14,6 @@ namespace search { class Result; } namespace qt { class DrawWidget; - class UpdateDialog; class MainWindow : public QMainWindow, location::LocationObserver { @@ -23,10 +23,6 @@ namespace qt QDockWidget * m_Docks[3]; -#ifndef NO_DOWNLOADER - UpdateDialog * m_updateDialog; -#endif // NO_DOWNLOADER - scoped_ptr<location::LocationService> m_locationService; Q_OBJECT @@ -66,6 +62,7 @@ namespace qt void ShowClassifPanel(); void ShowGuidePanel(); #endif // NO_DOWNLOADER + void OnPreferences(); void OnAbout(); void OnMyPosition(); diff --git a/qt/update_dialog.cpp b/qt/update_dialog.cpp index cf9c06ed39..722648bd1b 100644 --- a/qt/update_dialog.cpp +++ b/qt/update_dialog.cpp @@ -42,9 +42,6 @@ enum namespace qt { -/////////////////////////////////////////////////////////////////////////////// -// Helpers -/////////////////////////////////////////////////////////////////////////////// /// adds custom sorting for "Size" column class QTreeWidgetItemWithCustomSorting : public QTreeWidgetItem { @@ -54,7 +51,7 @@ namespace qt return data(KColumnIndexSize, Qt::UserRole).toULongLong() < other.data(KColumnIndexSize, Qt::UserRole).toULongLong(); } }; -//////////////////////////////////////////////////////////////////////////////// + UpdateDialog::UpdateDialog(QWidget * parent, Storage & storage) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), @@ -335,7 +332,7 @@ namespace qt } } - void UpdateDialog::ShowDialog() + void UpdateDialog::ShowModal() { // if called for first time if (!m_tree->topLevelItemCount()) @@ -343,5 +340,4 @@ namespace qt exec(); } - } diff --git a/qt/update_dialog.hpp b/qt/update_dialog.hpp index 12a061b1f1..6d788ee028 100644 --- a/qt/update_dialog.hpp +++ b/qt/update_dialog.hpp @@ -26,7 +26,7 @@ namespace qt pair<int64_t, int64_t> const & progress); //@} - void ShowDialog(); + void ShowModal(); private slots: void OnItemClick(QTreeWidgetItem * item, int column); |