summaryrefslogtreecommitdiffstats
path: root/src/kernel/qeventloop_unix_glib.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2015-07-19 22:04:28 +0900
committerMichele Calgaro <[email protected]>2015-08-26 23:13:47 +0900
commit8eefba828fef6908ef67d610e9fbbb4abb28d3ba (patch)
treec8887269085094c5f9ae56dec797da1001f06003 /src/kernel/qeventloop_unix_glib.cpp
parentd1fd5b9b238e16c1ee25f9dbb00a6a964d4061b9 (diff)
downloadqt3-8eefba828fef6908ef67d610e9fbbb4abb28d3ba.tar.gz
qt3-8eefba828fef6908ef67d610e9fbbb4abb28d3ba.zip
Added safety harness for currentThreadObject() usage.
currentThreadObject() returns a null pointer if the current thread was not started using the QThread API. This relates to bug 1748. (cherry picked from commit dad70b4c5201ece044ecb663bb91b48ba8bd84a3) Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/kernel/qeventloop_unix_glib.cpp')
-rw-r--r--src/kernel/qeventloop_unix_glib.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/kernel/qeventloop_unix_glib.cpp b/src/kernel/qeventloop_unix_glib.cpp
index feff675..c41acce 100644
--- a/src/kernel/qeventloop_unix_glib.cpp
+++ b/src/kernel/qeventloop_unix_glib.cpp
@@ -688,7 +688,9 @@ int QEventLoop::activateTimers()
QTimerEvent e( t->id );
#if defined(QT_THREAD_SUPPORT)
// Be careful...the current thread may not be the target object's thread!
- if ((!t->obj) || (QThread::currentThreadObject()->threadPostedEventsDisabled()) || (t->obj && (t->obj->contextThreadObject() == QThread::currentThreadObject()))) {
+ if ((!t->obj) ||
+ (QThread::currentThreadObject() && QThread::currentThreadObject()->threadPostedEventsDisabled()) ||
+ (t->obj && t->obj->contextThreadObject() == QThread::currentThreadObject())) {
QApplication::sendEvent( t->obj, &e ); // send event
}
else {
@@ -731,7 +733,9 @@ int QEventLoop::activateSocketNotifiers()
sn->pending = FALSE;
#if defined(QT_THREAD_SUPPORT)
// Be careful...the current thread may not be the target object's thread!
- if ((!sn->obj) || (QThread::currentThreadObject()->threadPostedEventsDisabled()) || (sn->obj && (sn->obj->contextThreadObject() == QThread::currentThreadObject()))) {
+ if ((!sn->obj) ||
+ (QThread::currentThreadObject() && QThread::currentThreadObject()->threadPostedEventsDisabled()) ||
+ (sn->obj && sn->obj->contextThreadObject() == QThread::currentThreadObject())) {
QApplication::sendEvent( sn->obj, &event ); // send event
}
else {