From 0e8e2d5b103afa508f33c70904271e4fe72c870e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 3 Dec 2016 07:11:31 +0100 Subject: compat: add asserts --- compat/run-in-thread.hpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'compat') diff --git a/compat/run-in-thread.hpp b/compat/run-in-thread.hpp index c32c232d..90aa143b 100644 --- a/compat/run-in-thread.hpp +++ b/compat/run-in-thread.hpp @@ -1,11 +1,15 @@ #pragma once -#include +#include "ndebug-guard.hpp" +#include #include #include #include +#include +#include + namespace qt_impl_detail { template @@ -50,7 +54,9 @@ auto run_in_thread_sync(QObject* obj, F&& fun) { QObject src; - src.moveToThread(obj->thread()); + QThread* t(obj->thread()); + assert(t); + src.moveToThread(t); QObject::connect(&src, &QObject::destroyed, obj, @@ -80,6 +86,8 @@ template void run_in_thread_async(QObject* obj, F&& fun) { QObject src; - src.moveToThread(obj->thread()); + QThread* t(obj->thread()); + assert(t); + src.moveToThread(t); QObject::connect(&src, &QObject::destroyed, obj, std::move(fun), Qt::AutoConnection); } -- cgit v1.2.3