Subject: Bug#1447: x2godesktopsharing termination

From: Oleg Solovyov <[email-masked]>
Date: Fri, 20 Mar 2020 11:40:28 +0300

Package: x2godesktopsharing
Version: 3.2.0.0
Severity: grave

When connecting from machine A to machine B, x2godesktopsharing running on B, 
exits normally instead of changing its tray icon to view.png

ALT Workstation 9, using MATE with kernel 4.19.79-std-def-alt1

---

From: mcpain <[email-masked]>
Date: Wed, 01 Apr 2020 12:31:40 +0300

ping

---

From: [email-masked]
Date: Wed, 01 Apr 2020 15:10:50 +0300

Also reproducible on:
Fedora 29 (MATE)
Ubuntu 19.10 (MATE)

---

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();
 }

---

From: Mike Gabriel <[email-masked]>
Date: Tue, 07 Apr 2020 19:12:10 +0000

Hi Alex,

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

Can you take a look at the proposed patch and let me know if the  
proposal is the way to go? Thanks.

Thanks

-- 

DAS-NETZWERKTEAM
c\o Technik- und Ökologiezentrum Eckernförde
Mike Gabriel, Marienthaler str. 17, 24340 Eckernförde
mobile: +49 (1520) 1976 148
landline: +49 (4351) 850 8940

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: [email-masked], http://das-netzwerkteam.de

---

From: Oleksandr Shneyder <[email-masked]>
Date: Fri, 10 Apr 2020 12:21:18 -0500

Hi Mike,
looks reasonable.

regards
Alex

-- 
-----------------------------------------------------------
Oleksandr Shneyder        | Email: [email-masked]
phoca GmbH                | Tel. : 0911 - 14870374 0
Schleiermacherstr. 2      | Fax. : 0911 - 14870374 9
D-90491 Nürnberg          | Mobil: 0163 - 49 64 461

Geschäftsführung: Dipl.-Inf. Oleksandr Shneyder

Amtsgericht München       | http://www.phoca-gmbh.de
HRB 196 658               | http://www.x2go.org
USt-IdNr.: DE281977973
-----------------------------------------------------------