summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-04-20 08:34:03 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2010-04-20 09:30:52 (GMT)
commitbb0aa3c61e8c443ec4207381ca10c85f6c4b6665 (patch)
tree2b0255635a72040b2cbb3abd9e49bca07c380677
parentd66a6da84af01f1a6d4fd52d9b1cbec72a4fae3c (diff)
downloadQt-bb0aa3c61e8c443ec4207381ca10c85f6c4b6665.zip
Qt-bb0aa3c61e8c443ec4207381ca10c85f6c4b6665.tar.gz
Qt-bb0aa3c61e8c443ec4207381ca10c85f6c4b6665.tar.bz2
Fix crash on startup on Symbian OS
The changes to QThread introduced by commit 9aa4538b219ed759a47e8d1f93c2797bf07b5e2f mean that the QThread constructor calls into the event dispatcher. The Symbian event dispatcher owns a QThread, so it crashed when the code re-entered the partially constructed event dispatcher and used an uninitialised pointer. This change delays construction of the QThread until the point of use, so that the event dispatcher is fully constructed. Task-number: QTBUG-10029 Reviewed-by: Jason Barron (cherry picked from commit 2b55d52669beb72396f94e449fdf172735349b3b)
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp20
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian_p.h3
2 files changed, 17 insertions, 6 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index ca44264..f811361 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -632,6 +632,7 @@ void QSocketActiveObject::deleteLater()
QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent)
: QAbstractEventDispatcher(parent),
+ m_selectThread(0),
m_activeScheduler(0),
m_wakeUpAO(0),
m_completeDeferredAOs(0),
@@ -659,11 +660,19 @@ void QEventDispatcherSymbian::startingUp()
wakeUp();
}
+QSelectThread& QEventDispatcherSymbian::selectThread() {
+ if (!m_selectThread)
+ m_selectThread = new QSelectThread;
+ return *m_selectThread;
+}
+
void QEventDispatcherSymbian::closingDown()
{
- if (m_selectThread.isRunning()) {
- m_selectThread.stop();
+ if (m_selectThread && m_selectThread->isRunning()) {
+ m_selectThread->stop();
}
+ delete m_selectThread;
+ m_selectThread = 0;
delete m_completeDeferredAOs;
delete m_wakeUpAO;
@@ -935,12 +944,13 @@ void QEventDispatcherSymbian::registerSocketNotifier ( QSocketNotifier * notifie
{
QSocketActiveObject *socketAO = q_check_ptr(new QSocketActiveObject(this, notifier));
m_notifiers.insert(notifier, socketAO);
- m_selectThread.requestSocketEvents(notifier, &socketAO->iStatus);
+ selectThread().requestSocketEvents(notifier, &socketAO->iStatus);
}
void QEventDispatcherSymbian::unregisterSocketNotifier ( QSocketNotifier * notifier )
{
- m_selectThread.cancelSocketEvents(notifier);
+ if (m_selectThread)
+ m_selectThread->cancelSocketEvents(notifier);
if (m_notifiers.contains(notifier)) {
QSocketActiveObject *sockObj = *m_notifiers.find(notifier);
m_deferredSocketEvents.removeAll(sockObj);
@@ -951,7 +961,7 @@ void QEventDispatcherSymbian::unregisterSocketNotifier ( QSocketNotifier * notif
void QEventDispatcherSymbian::reactivateSocketNotifier(QSocketNotifier *notifier)
{
- m_selectThread.requestSocketEvents(notifier, &m_notifiers[notifier]->iStatus);
+ selectThread().requestSocketEvents(notifier, &m_notifiers[notifier]->iStatus);
}
void QEventDispatcherSymbian::registerTimer ( int timerId, int interval, QObject * object )
diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h
index 1ab31cc..5281199 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian_p.h
+++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h
@@ -259,8 +259,9 @@ private:
bool sendPostedEvents();
bool sendDeferredSocketEvents();
+ QSelectThread& selectThread();
private:
- QSelectThread m_selectThread;
+ QSelectThread *m_selectThread;
CQtActiveScheduler *m_activeScheduler;