QSystemTrayIcon: Fix double connection with qpa.

install_sys_qpa() is called for each QSystemTrayIcon::show(),
leading to spurious calls of user slots if the signal isn't
disconnected on remove_sys_qpa().

Task-number: QTBUG-48068
Change-Id: Ic830250c71fee6b584550ab5aabf54289e478fcb
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Richard Rondu <rondu.richard@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
This commit is contained in:
Christian Kamm 2015-09-02 10:36:40 +02:00 committed by Liang Qi
parent 64481bcc67
commit 1e2d35d488

View File

@ -693,6 +693,10 @@ void QSystemTrayIconPrivate::install_sys_qpa()
void QSystemTrayIconPrivate::remove_sys_qpa()
{
QObject::disconnect(qpa_sys, SIGNAL(activated(QPlatformSystemTrayIcon::ActivationReason)),
q_func(), SLOT(_q_emitActivated(QPlatformSystemTrayIcon::ActivationReason)));
QObject::disconnect(qpa_sys, &QPlatformSystemTrayIcon::messageClicked,
q_func(), &QSystemTrayIcon::messageClicked);
qpa_sys->cleanup();
}