From 8f06f8a31682760b385ba740db28429d7914730a Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 19 Jun 2016 19:23:56 +0200 Subject: Don't use a static for the threadboundary Otherwise we risk calling into already destroyed models. --- common/modelresult.cpp | 2 -- common/modelresult.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'common') 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 @@ #include "domain/folder.h" #include "log.h" -#include "threadboundary.h" #undef DEBUG_AREA #define DEBUG_AREA "client.modelresult" @@ -253,7 +252,6 @@ void ModelResult::setFetcher(const std::function void ModelResult::setEmitter(const typename Sink::ResultEmitter::Ptr &emitter) { - static async::ThreadBoundary threadBoundary; setFetcher([this](const Ptr &parent) { mEmitter->fetch(parent); }); 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 @@ #include #include "query.h" #include "resultprovider.h" +#include "threadboundary.h" template class ModelResult : public QAbstractItemModel @@ -76,4 +77,5 @@ private: Sink::Query mQuery; std::function loadEntities; typename Sink::ResultEmitter::Ptr mEmitter; + async::ThreadBoundary threadBoundary; }; -- cgit v1.2.3