summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject_impl.h
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2011-11-29 01:44:18 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-30 01:04:12 +0100
commit55b974faa158a36cb0ab39fd9cfd11b2f6c186ba (patch)
treefde69f585180dc7ef8b70563abba2a10c9620eb5 /src/corelib/kernel/qobject_impl.h
parentfa7f690178d2f74db168a23064a688fe421cb1e6 (diff)
Fix Qt::QueuedConnection when signal has a return value
For queued connections, the args[0] is set to null as it make no sens to forward the return value to the signal. So we need to check in the operator, that the pointer is not null. (container.data is args[0]) Change-Id: I80bde66f1ec19de0f4962c80e5b2797d2819075c Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/kernel/qobject_impl.h')
-rw-r--r--src/corelib/kernel/qobject_impl.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h
index 9918b1f1c2..d34b81ceaf 100644
--- a/src/corelib/kernel/qobject_impl.h
+++ b/src/corelib/kernel/qobject_impl.h
@@ -96,12 +96,14 @@ namespace QtPrivate {
};
template<typename T, typename U>
void operator,(const T &value, const ApplyReturnValue<U> &container) {
- *reinterpret_cast<U*>(container.data) = value;
+ if (container.data)
+ *reinterpret_cast<U*>(container.data) = value;
}
#ifdef Q_COMPILER_RVALUE_REFS
template<typename T, typename U>
void operator,(T &&value, const ApplyReturnValue<U> &container) {
- *reinterpret_cast<U*>(container.data) = value;
+ if (container.data)
+ *reinterpret_cast<U*>(container.data) = value;
}
#endif
template<typename T>