From: Manuel Nickschas Date: Sun, 2 Sep 2018 21:23:06 +0000 (+0200) Subject: sigproxy: Don't expose the thread_local '_current' attribute X-Git-Tag: test-travis-01~152 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=fb80dab2044d302eb8ccacd0b34d4cbaf5fe904c sigproxy: Don't expose the thread_local '_current' attribute Windows does not allow exporting thread_local attributes in the DLL interface. Since it's not good practice anyway to expose such an implementation detail in the public header, make the accessor non-inline and move the attribute into a private anonymous namespace, removing it from the public interface. --- diff --git a/src/common/signalproxy.cpp b/src/common/signalproxy.cpp index 19b9af83..721f32a4 100644 --- a/src/common/signalproxy.cpp +++ b/src/common/signalproxy.cpp @@ -166,7 +166,9 @@ int SignalProxy::SignalRelay::qt_metacall(QMetaObject::Call _c, int _id, void ** // SignalProxy // ================================================== -thread_local SignalProxy *SignalProxy::_current{nullptr}; +namespace { +thread_local SignalProxy *_current{nullptr}; +} SignalProxy::SignalProxy(QObject *parent) : QObject(parent) @@ -204,6 +206,12 @@ SignalProxy::~SignalProxy() } +SignalProxy *SignalProxy::current() +{ + return _current; +} + + void SignalProxy::setProxyMode(ProxyMode mode) { if (!_peerMap.empty()) { diff --git a/src/common/signalproxy.h b/src/common/signalproxy.h index f3ea4c52..a3d7703e 100644 --- a/src/common/signalproxy.h +++ b/src/common/signalproxy.h @@ -80,9 +80,7 @@ public: void dumpProxyStats(); void dumpSyncMap(SyncableObject *object); - static SignalProxy *current() { - return _current; - } + static SignalProxy *current(); /**@{*/ /** @@ -217,8 +215,6 @@ private: Peer *_sourcePeer = nullptr; Peer *_targetPeer = nullptr; - thread_local static SignalProxy *_current; - friend class SignalRelay; friend class SyncableObject; friend class Peer;