blizzard4591 / openMittsu

An open source implementation and desktop client of the Threema Messenger App.
Other
175 stars 22 forks source link

Closing on linux does not work #62

Closed fsatzger closed 4 years ago

fsatzger commented 4 years ago

I'm not able to close openMittsu under Linux (Mint 18 KDE).

Built from commit 83b25ff3861cd6e86c9c1ec5abd05b1d4cef205f with QT5.6

Could resolve the issue using the following patch,, but i'm unsure if there are any side-effects I didn't see (especially concerning graceful shutdown of the database and config file).

Furthermore the QSQLCipher warning does not quit the application other than stated (also adressed with this patch).

diff --git a/src/Client.cpp b/src/Client.cpp
index ce533ac..592f367 100644
--- a/src/Client.cpp
+++ b/src/Client.cpp
@@ -200,6 +203,7 @@ m_optionDatabaseFile() {
        QMessageBox::warning(this, tr("Database driver not available"), tr("openMittsu relies on SqlCipher and QSqlCipher for securely storing the database.\nThe QSQLCIPHER driver is not available. It should reside in the sqldrivers\\ subdirectory of openMittsu.\nWe will use the unencrypted SQLITE driver instead."));
 #else
        QMessageBox::critical(this, tr("Database driver not available"), tr("openMittsu relies on SqlCipher and QSqlCipher for securely storing the database.\nThe QSQLCIPHER driver is not available. It should reside in the sqldrivers\\ subdirectory of openMittsu.\nSince no encryption is available, OpenMittsu will now terminate."));
+       QApplication::exit(-1);
 #endif
    }

@@ -249,7 +253,7 @@ m_optionDatabaseFile() {
    OPENMITTSU_CONNECT(m_ui->actionOptions, triggered(), this, menuFileOptionsOnClick());
    OPENMITTSU_CONNECT(m_ui->actionShow_First_Use_Wizard, triggered(), this, menuFileShowFirstUseWizardOnClick());
    OPENMITTSU_CONNECT(m_ui->actionExit, triggered(), this, menuFileExitOnClick());
-
+   OPENMITTSU_CONNECT(qApp, aboutToQuit(), this, close());
    m_protocolClientThread.start();
    OPENMITTSU_CONNECT(&m_protocolClientThread, finished(), this, threadFinished());

@@ -1068,6 +1072,7 @@ void Client::menuFileShowFirstUseWizardOnClick() {

 void Client::menuFileExitOnClick() {
    this->close();
+   QApplication::exit(1);
 }

 void Client::menuAboutLicenseOnClick() {

diff --git a/src/widgets/DesktopNotification.cpp b/src/widgets/DesktopNotification.cpp
index d457412..1337125 100644
--- a/src/widgets/DesktopNotification.cpp
+++ b/src/widgets/DesktopNotification.cpp
@@ -54,6 +54,7 @@ namespace openmittsu {
        void DesktopNotification::trayMenu_exitOnTriggered() {
            m_isClosing = true;
            m_mainWindow->close();
+           QApplication::exit(0);
        }

        bool DesktopNotification::isClosing() const {
blizzard4591 commented 4 years ago

Thanks, merged :)