summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-10-18 12:45:28 (GMT)
committermread <qt-info@nokia.com>2011-10-18 13:13:13 (GMT)
commitb7179d6f284e277b84c54226be05832a25576387 (patch)
tree19e60d8c98ef3bd5fa87ae0f876972c178070335 /src/corelib/kernel/qobject.cpp
parent20b00a46fefcbfd75c6c8d758a42ad0d31ae9a84 (diff)
downloadQt-b7179d6f284e277b84c54226be05832a25576387.zip
Qt-b7179d6f284e277b84c54226be05832a25576387.tar.gz
Qt-b7179d6f284e277b84c54226be05832a25576387.tar.bz2
Fixed access to null threadData in ~QObjectPrivate
If a class derived from QObjectPrivate throws an exception in its constructor, ~QObjectPrivate will be invoked with threadData being null. This change tests for null before accessing threadData. Task-number: QTBUG-4871 incidental finding Reviewed-by: Shane Kearns
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r--src/corelib/kernel/qobject.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 5d6e4d7..1f716bc 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -163,14 +163,15 @@ QObjectPrivate::~QObjectPrivate()
{
if (pendTimer) {
// unregister pending timers
- if (threadData->eventDispatcher)
+ if (threadData && threadData->eventDispatcher)
threadData->eventDispatcher->unregisterTimers(q_ptr);
}
if (postedEvents)
QCoreApplication::removePostedEvents(q_ptr, 0);
- threadData->deref();
+ if (threadData)
+ threadData->deref();
delete static_cast<QAbstractDynamicMetaObject*>(metaObject);
#ifdef QT_JAMBI_BUILD