From 16f033fb13a3005eefbe8b7b6ccc52bfda08649e Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 19 Mar 2019 11:21:19 +0100 Subject: Address compile error on gcc 4.8 This partly reverts b3b387698e8f685e8bd4f4843a170da40e17249b. The global static connect was not correct. Furthermore the new global static variable was triggering src/nfc/qnearfieldtarget_emulator_p.h:125:31: warning: 'globalTagActivator' defined but not used [-Wunused-variable] The global static variable is shifted to no longer require exposure inside the header file. Fixes: QTBUG-74538 Change-Id: Ic5e8211d358bae9c2ed0418aec5c4316fb249c98 Reviewed-by: Oliver Wolff --- src/nfc/qnearfieldmanager_emulator.cpp | 9 +++++---- src/nfc/qnearfieldtarget_emulator.cpp | 7 +++++++ src/nfc/qnearfieldtarget_emulator_p.h | 2 -- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/nfc/qnearfieldmanager_emulator.cpp b/src/nfc/qnearfieldmanager_emulator.cpp index 8a61a3a9..4b5e5e0c 100644 --- a/src/nfc/qnearfieldmanager_emulator.cpp +++ b/src/nfc/qnearfieldmanager_emulator.cpp @@ -49,10 +49,11 @@ QT_BEGIN_NAMESPACE QNearFieldManagerPrivateImpl::QNearFieldManagerPrivateImpl() { - globalTagActivator->initialize(); + TagActivator *activator = TagActivator::instance(); + activator->initialize(); - connect(globalTagActivator, &TagActivator::tagActivated, this, &QNearFieldManagerPrivateImpl::tagActivated); - connect(globalTagActivator, &TagActivator::tagDeactivated, this, &QNearFieldManagerPrivateImpl::tagDeactivated); + connect(activator, &TagActivator::tagActivated, this, &QNearFieldManagerPrivateImpl::tagActivated); + connect(activator, &TagActivator::tagDeactivated, this, &QNearFieldManagerPrivateImpl::tagDeactivated); } QNearFieldManagerPrivateImpl::~QNearFieldManagerPrivateImpl() @@ -66,7 +67,7 @@ bool QNearFieldManagerPrivateImpl::isAvailable() const void QNearFieldManagerPrivateImpl::reset() { - globalTagActivator->reset(); + TagActivator::instance()->reset(); } void QNearFieldManagerPrivateImpl::tagActivated(TagBase *tag) diff --git a/src/nfc/qnearfieldtarget_emulator.cpp b/src/nfc/qnearfieldtarget_emulator.cpp index 0723b655..aecd743e 100644 --- a/src/nfc/qnearfieldtarget_emulator.cpp +++ b/src/nfc/qnearfieldtarget_emulator.cpp @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE static QMutex tagMutex; static QMap tagMap; +Q_GLOBAL_STATIC(TagActivator, globalTagActivator); + TagType1::TagType1(TagBase *tag, QObject *parent) : QNearFieldTagType1(parent), m_tag(tag) { @@ -247,6 +249,11 @@ void TagActivator::reset() tagMap.clear(); } +TagActivator *TagActivator::instance() +{ + return globalTagActivator(); +} + void TagActivator::timerEvent(QTimerEvent *e) { Q_UNUSED(e); diff --git a/src/nfc/qnearfieldtarget_emulator_p.h b/src/nfc/qnearfieldtarget_emulator_p.h index 1b9f7bdb..70a67be8 100644 --- a/src/nfc/qnearfieldtarget_emulator_p.h +++ b/src/nfc/qnearfieldtarget_emulator_p.h @@ -122,8 +122,6 @@ private: int timerId; }; -Q_GLOBAL_STATIC(TagActivator, globalTagActivator); - QT_END_NAMESPACE #endif // QNEARFIELDTARGET_EMULATOR_P_H -- cgit v1.2.3