summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-04-20 08:34:03 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-04-20 08:34:03 (GMT)
commit2b55d52669beb72396f94e449fdf172735349b3b (patch)
treee668413c7cdfe72a33f1523f188d6b00e9d7c5f8 /src
parent99fede9d683b312fa79f45aa60c38bcb143c38fd (diff)
downloadQt-2b55d52669beb72396f94e449fdf172735349b3b.zip
Qt-2b55d52669beb72396f94e449fdf172735349b3b.tar.gz
Qt-2b55d52669beb72396f94e449fdf172735349b3b.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
Diffstat (limited to 'src')
-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 8c96057..3b86e89 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -638,6 +638,7 @@ void QSocketActiveObject::deleteLater()
QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent)
: QAbstractEventDispatcher(parent),
+ m_selectThread(0),
m_activeScheduler(0),
m_wakeUpAO(0),
m_completeDeferredAOs(0),
@@ -665,11 +666,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;
@@ -941,12 +950,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);
@@ -957,7 +967,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;