From 28df59b9e6cfc00584eeaee98d85c1473d2f7839 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Sat, 16 Feb 2013 13:23:38 +0400 Subject: [PATCH] Attempt to fix data loss during session end --- src/mainwindow.cpp | 4 +--- src/sessionapplication.cpp | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 842c8e52a..ff0e604d0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -103,7 +103,7 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION))); displaySpeedInTitle = pref.speedInTitleBar(); // Clean exit on log out - connect(static_cast(qApp), SIGNAL(sessionIsShuttingDown()), this, SLOT(deleteBTSession())); + connect(static_cast(qApp), SIGNAL(sessionIsShuttingDown()), this, SLOT(deleteBTSession()), Qt::DirectConnection); // Setting icons #if defined(Q_WS_X11) if (Preferences().useSystemIconTheme()) @@ -334,8 +334,6 @@ void MainWindow::deleteBTSession() { m_pwr->setActivityState(false); // Save window size, columns size writeSettings(); - // Accept exit - qApp->exit(); } // Destructor diff --git a/src/sessionapplication.cpp b/src/sessionapplication.cpp index 8a06abedf..f2a08ad62 100644 --- a/src/sessionapplication.cpp +++ b/src/sessionapplication.cpp @@ -42,6 +42,7 @@ QtSingleApplication(id, argc, argv) void SessionApplication::commitData(QSessionManager & manager) { Q_UNUSED(manager); emit sessionIsShuttingDown(); + manager.release(); } bool SessionApplication::notify(QObject* receiver, QEvent* event) {