diff --git a/src/headlessloader.h b/src/headlessloader.h index 6ed1b2acb..1113213c9 100644 --- a/src/headlessloader.h +++ b/src/headlessloader.h @@ -41,7 +41,7 @@ class HeadlessLoader: public QObject { public: HeadlessLoader(const QStringList &torrentCmdLine) { - connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(deleteBTSession()), Qt::DirectConnection); + connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(shutdownCleanUp()), Qt::DirectConnection); Preferences pref; // Enable Web UI pref.setWebUiEnabled(true); @@ -63,7 +63,8 @@ public: } public slots: - void deleteBTSession() { + void shutdownCleanUp() { + Preferences().sync(); QBtSession::drop(); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c94f57f80..9aeb545f4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -110,7 +110,7 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa setWindowTitle(QString("qBittorrent %1").arg(QString::fromUtf8(VERSION))); displaySpeedInTitle = pref.speedInTitleBar(); // Clean exit on log out - connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(deleteBTSession()), Qt::DirectConnection); + connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(shutdownCleanUp()), Qt::DirectConnection); // Setting icons #if defined(Q_WS_X11) if (Preferences().useSystemIconTheme()) @@ -336,7 +336,7 @@ MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMa } } -void MainWindow::deleteBTSession() { +void MainWindow::shutdownCleanUp() { qDebug("GUI destruction"); hide(); guiUpdater->stop(); @@ -390,6 +390,7 @@ void MainWindow::deleteBTSession() { delete switchTransferShortcut; delete switchRSSShortcut; IconProvider::drop(); + Preferences().sync(); qDebug("Finished GUI destruction"); } diff --git a/src/mainwindow.h b/src/mainwindow.h index b1c1b6f53..f811d98a8 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -85,7 +85,7 @@ public slots: void downloadFromURLList(const QStringList& urls); void updateAltSpeedsBtn(bool alternative); void updateNbTorrents(); - void deleteBTSession(); + void shutdownCleanUp(); protected slots: // GUI related slots