Subject: Bug#1447: x2godesktopsharing termination

From: [email-masked]
Date: Mon, 06 Apr 2020 10:56:22 +0300

В письме от среда, 1 апреля 2020 г. 15:10:50 MSK пользователь 
[email-masked] написал:
> Also reproducible on:
> Fedora 29 (MATE)
> Ubuntu 19.10 (MATE)
> _______________________________________________
> x2go-dev mailing list
> [email-masked]
> https://lists.x2go.org/listinfo/x2go-dev

When QCoreApplicationPrivate::maybeQuit() is called, quitLockRef.load() == 0, 
hence QEvent::Quit is sent on MATE and application terminates.
KDE is fine because there is plasma-integration package, which provides 
KDEPlatformSystemTrayIcon and quitLockRef.load() != 0 when maybeQuit() is 
called.

Took a look at other Qt5 applications like Psi+ and made a patch with similar 
workaround.

diff --git a/main.cpp b/main.cpp
index f01efbc..8a87103 100644
--- a/main.cpp
+++ b/main.cpp
@@ -133,6 +133,7 @@ int main ( int argc, char *argv[] )
 		}
 	}
 
+	QApplication::setQuitOnLastWindowClosed(false);
 	QApplication app ( argc,argv );
 	QStringList args=QCoreApplication::arguments();
 
diff --git a/sharetray.cpp b/sharetray.cpp
index 2fcce62..1bf8c26 100644
--- a/sharetray.cpp
+++ b/sharetray.cpp
@@ -771,6 +771,7 @@ void ShareTray::slotDelListItem()
 void ShareTray::slotMenuClose()
 {
 	menuClose=true;
+	QApplication::setQuitOnLastWindowClosed(true);
 	close();
 }