summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2019-03-19 11:21:19 +0100
committerAlex Blasche <alexander.blasche@qt.io>2019-03-19 14:03:23 +0000
commit16f033fb13a3005eefbe8b7b6ccc52bfda08649e (patch)
treeec0fd8e7650314b79721992b0818dcba50d1f490
parenta61ee48bc16fae61cabb9a242f3a7c19caa4cbfd (diff)
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 <oliver.wolff@qt.io>
-rw-r--r--src/nfc/qnearfieldmanager_emulator.cpp9
-rw-r--r--src/nfc/qnearfieldtarget_emulator.cpp7
-rw-r--r--src/nfc/qnearfieldtarget_emulator_p.h2
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<TagBase *, bool> 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