diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2015-07-19 21:49:36 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2015-07-19 21:49:36 +0900 |
commit | caab7b355740dd9661046c1bf73e1add9de9d045 (patch) | |
tree | 6bbe19874ed5e3e85ded331b5439122fec37b56e /src/kernel/qeventloop_unix_glib.cpp | |
parent | 42dcb07b2621c909527421e86a5c0ee48fd759bc (diff) | |
download | tqt3-caab7b355740dd9661046c1bf73e1add9de9d045.tar.gz tqt3-caab7b355740dd9661046c1bf73e1add9de9d045.zip |
Added safety harness for currentThreadObject() usage.
currentThreadObject() returns a null pointer if the
current thread was not started using the TQThread API.
This relates to bug 1748.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/kernel/qeventloop_unix_glib.cpp')
-rw-r--r-- | src/kernel/qeventloop_unix_glib.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/kernel/qeventloop_unix_glib.cpp b/src/kernel/qeventloop_unix_glib.cpp index 795dc9ba8..ceacd81b8 100644 --- a/src/kernel/qeventloop_unix_glib.cpp +++ b/src/kernel/qeventloop_unix_glib.cpp @@ -688,7 +688,9 @@ int TQEventLoop::activateTimers() TQTimerEvent e( t->id ); #if defined(QT_THREAD_SUPPORT) // Be careful...the current thread may not be the target object's thread! - if ((!t->obj) || (TQThread::currentThreadObject()->threadPostedEventsDisabled()) || (t->obj && (t->obj->contextThreadObject() == TQThread::currentThreadObject()))) { + if ((!t->obj) || + (TQThread::currentThreadObject() && TQThread::currentThreadObject()->threadPostedEventsDisabled()) || + (t->obj && t->obj->contextThreadObject() == TQThread::currentThreadObject())) { TQApplication::sendEvent( t->obj, &e ); // send event } else { @@ -731,7 +733,9 @@ int TQEventLoop::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) || (TQThread::currentThreadObject()->threadPostedEventsDisabled()) || (sn->obj && (sn->obj->contextThreadObject() == TQThread::currentThreadObject()))) { + if ((!sn->obj) || + (TQThread::currentThreadObject() && TQThread::currentThreadObject()->threadPostedEventsDisabled()) || + (sn->obj && sn->obj->contextThreadObject() == TQThread::currentThreadObject())) { TQApplication::sendEvent( sn->obj, &event ); // send event } else { |