diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-22 14:43:23 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-22 14:43:23 +0100 |
commit | 28c40c63f557fa05c402c9c88ffbe9bfdca20648 (patch) | |
tree | 7256083b2d1d06a275ea237b90d5453e5d37680c /common | |
parent | c799105ca6b4107fa19de9845247f1f3322ea6ef (diff) | |
download | sink-28c40c63f557fa05c402c9c88ffbe9bfdca20648.tar.gz sink-28c40c63f557fa05c402c9c88ffbe9bfdca20648.zip |
Never remove the static facades.
This fixes the clientapitest.
Diffstat (limited to 'common')
-rw-r--r-- | common/facadefactory.cpp | 1 | ||||
-rw-r--r-- | common/facadefactory.h | 6 | ||||
-rw-r--r-- | common/store.cpp | 4 |
3 files changed, 9 insertions, 2 deletions
diff --git a/common/facadefactory.cpp b/common/facadefactory.cpp index 9342831..c26c0a1 100644 --- a/common/facadefactory.cpp +++ b/common/facadefactory.cpp | |||
@@ -51,6 +51,7 @@ void FacadeFactory::resetFactory() | |||
51 | { | 51 | { |
52 | QMutexLocker locker(&sMutex); | 52 | QMutexLocker locker(&sMutex); |
53 | mFacadeRegistry.clear(); | 53 | mFacadeRegistry.clear(); |
54 | registerStaticFacades(); | ||
54 | } | 55 | } |
55 | 56 | ||
56 | void FacadeFactory::registerStaticFacades() | 57 | void FacadeFactory::registerStaticFacades() |
diff --git a/common/facadefactory.h b/common/facadefactory.h index 8d41705..afd08b6 100644 --- a/common/facadefactory.h +++ b/common/facadefactory.h | |||
@@ -92,6 +92,12 @@ public: | |||
92 | return std::static_pointer_cast<StoreFacade<DomainType>>(ptr); | 92 | return std::static_pointer_cast<StoreFacade<DomainType>>(ptr); |
93 | } | 93 | } |
94 | 94 | ||
95 | template <class DomainType> | ||
96 | std::shared_ptr<StoreFacade<DomainType>> getFacade() | ||
97 | { | ||
98 | return getFacade<DomainType>(QByteArray(), QByteArray()); | ||
99 | } | ||
100 | |||
95 | private: | 101 | private: |
96 | FacadeFactory(); | 102 | FacadeFactory(); |
97 | std::shared_ptr<void> getFacade(const QByteArray &resource, const QByteArray &instanceIdentifier, const QByteArray &typeName); | 103 | std::shared_ptr<void> getFacade(const QByteArray &resource, const QByteArray &instanceIdentifier, const QByteArray &typeName); |
diff --git a/common/store.cpp b/common/store.cpp index 5e0c327..6aae00f 100644 --- a/common/store.cpp +++ b/common/store.cpp | |||
@@ -146,7 +146,7 @@ QSharedPointer<QAbstractItemModel> Store::loadModel(Query query) | |||
146 | 146 | ||
147 | if (query.liveQuery() && query.getResourceFilter().ids.isEmpty() && !ApplicationDomain::isGlobalType(ApplicationDomain::getTypeName<DomainType>())) { | 147 | if (query.liveQuery() && query.getResourceFilter().ids.isEmpty() && !ApplicationDomain::isGlobalType(ApplicationDomain::getTypeName<DomainType>())) { |
148 | SinkTrace() << "Listening for new resources"; | 148 | SinkTrace() << "Listening for new resources"; |
149 | auto facade = FacadeFactory::instance().getFacade<ApplicationDomain::SinkResource>("", ""); | 149 | auto facade = FacadeFactory::instance().getFacade<ApplicationDomain::SinkResource>(); |
150 | Q_ASSERT(facade); | 150 | Q_ASSERT(facade); |
151 | Sink::Query resourceQuery; | 151 | Sink::Query resourceQuery; |
152 | query.setFlags(Query::LiveQuery); | 152 | query.setFlags(Query::LiveQuery); |
@@ -187,7 +187,7 @@ template <class DomainType> | |||
187 | static std::shared_ptr<StoreFacade<DomainType>> getFacade(const QByteArray &resourceInstanceIdentifier) | 187 | static std::shared_ptr<StoreFacade<DomainType>> getFacade(const QByteArray &resourceInstanceIdentifier) |
188 | { | 188 | { |
189 | if (ApplicationDomain::isGlobalType(ApplicationDomain::getTypeName<DomainType>())) { | 189 | if (ApplicationDomain::isGlobalType(ApplicationDomain::getTypeName<DomainType>())) { |
190 | if (auto facade = FacadeFactory::instance().getFacade<DomainType>("", "")) { | 190 | if (auto facade = FacadeFactory::instance().getFacade<DomainType>()) { |
191 | return facade; | 191 | return facade; |
192 | } | 192 | } |
193 | } | 193 | } |