diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-19 19:23:56 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-19 19:23:56 +0200 |
commit | 8f06f8a31682760b385ba740db28429d7914730a (patch) | |
tree | 85e83037d358f451bf353349ef14e87575221d58 | |
parent | ba16fd400dfd3468e90b9fe2683a4d9606fc99ee (diff) | |
download | sink-8f06f8a31682760b385ba740db28429d7914730a.tar.gz sink-8f06f8a31682760b385ba740db28429d7914730a.zip |
Don't use a static for the threadboundary
Otherwise we risk calling into already destroyed models.
-rw-r--r-- | common/modelresult.cpp | 2 | ||||
-rw-r--r-- | common/modelresult.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp index 9f3e662..3778d4d 100644 --- a/common/modelresult.cpp +++ b/common/modelresult.cpp | |||
@@ -24,7 +24,6 @@ | |||
24 | 24 | ||
25 | #include "domain/folder.h" | 25 | #include "domain/folder.h" |
26 | #include "log.h" | 26 | #include "log.h" |
27 | #include "threadboundary.h" | ||
28 | 27 | ||
29 | #undef DEBUG_AREA | 28 | #undef DEBUG_AREA |
30 | #define DEBUG_AREA "client.modelresult" | 29 | #define DEBUG_AREA "client.modelresult" |
@@ -253,7 +252,6 @@ void ModelResult<T, Ptr>::setFetcher(const std::function<void(const Ptr &parent) | |||
253 | template <class T, class Ptr> | 252 | template <class T, class Ptr> |
254 | void ModelResult<T, Ptr>::setEmitter(const typename Sink::ResultEmitter<Ptr>::Ptr &emitter) | 253 | void ModelResult<T, Ptr>::setEmitter(const typename Sink::ResultEmitter<Ptr>::Ptr &emitter) |
255 | { | 254 | { |
256 | static async::ThreadBoundary threadBoundary; | ||
257 | setFetcher([this](const Ptr &parent) { mEmitter->fetch(parent); }); | 255 | setFetcher([this](const Ptr &parent) { mEmitter->fetch(parent); }); |
258 | 256 | ||
259 | emitter->onAdded([this](const Ptr &value) { | 257 | emitter->onAdded([this](const Ptr &value) { |
diff --git a/common/modelresult.h b/common/modelresult.h index 64431da..7924e2d 100644 --- a/common/modelresult.h +++ b/common/modelresult.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <functional> | 27 | #include <functional> |
28 | #include "query.h" | 28 | #include "query.h" |
29 | #include "resultprovider.h" | 29 | #include "resultprovider.h" |
30 | #include "threadboundary.h" | ||
30 | 31 | ||
31 | template <class T, class Ptr> | 32 | template <class T, class Ptr> |
32 | class ModelResult : public QAbstractItemModel | 33 | class ModelResult : public QAbstractItemModel |
@@ -76,4 +77,5 @@ private: | |||
76 | Sink::Query mQuery; | 77 | Sink::Query mQuery; |
77 | std::function<void(const Ptr &)> loadEntities; | 78 | std::function<void(const Ptr &)> loadEntities; |
78 | typename Sink::ResultEmitter<Ptr>::Ptr mEmitter; | 79 | typename Sink::ResultEmitter<Ptr>::Ptr mEmitter; |
80 | async::ThreadBoundary threadBoundary; | ||
79 | }; | 81 | }; |