summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorLostDragonist <lost.dragonist@gmail.com>2018-12-20 20:55:03 -0600
committerLostDragonist <lost.dragonist@gmail.com>2018-12-20 20:56:31 -0600
commitafdd21440aa761e023f0ed991a75e318ad8298b7 (patch)
treec81abbad33385dcbe1f17377b4380bed0f33c73a /src/mainwindow.cpp
parenta899823fff90728e6bd7d7b7ee8fb6d2f3be1568 (diff)
Catch and report exceptions in the MainWindow deconstructor
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2e795c90..3b7fa917 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -460,12 +460,18 @@ MainWindow::MainWindow(QSettings &initSettings
MainWindow::~MainWindow()
{
- cleanup();
+ try {
+ cleanup();
- m_PluginContainer.setUserInterface(nullptr, nullptr);
- m_OrganizerCore.setUserInterface(nullptr, nullptr);
- m_IntegratedBrowser.close();
- delete ui;
+ m_PluginContainer.setUserInterface(nullptr, nullptr);
+ m_OrganizerCore.setUserInterface(nullptr, nullptr);
+ m_IntegratedBrowser.close();
+ delete ui;
+ } catch (std::exception &e) {
+ QMessageBox::critical(nullptr, tr("Crash on exit"),
+ tr("MO crashed while exiting. Some settings may not be saved.\n\nError: %1").arg(e.what()),
+ QMessageBox::Ok);
+ }
}
@@ -1324,7 +1330,6 @@ void MainWindow::delayedRemove()
void MainWindow::expandDataTreeItem(QTreeWidgetItem *item)
{
-
if ((item->childCount() == 1) && (item->child(0)->data(0, Qt::UserRole).toString() == "__loaded_on_demand__")) {
// read the data we need from the sub-item, then dispose of it
QTreeWidgetItem *onDemandDataItem = item->child(0);