diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 20 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian_p.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 9 |
3 files changed, 22 insertions, 10 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; diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index c12095f..9afcd80 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -88,7 +88,8 @@ enum { SECS_PER_HOUR = 3600, MSECS_PER_HOUR = 3600000, SECS_PER_MIN = 60, - MSECS_PER_MIN = 60000 + MSECS_PER_MIN = 60000, + JULIAN_DAY_FOR_EPOCH = 2440588 // result of julianDayFromGregorianDate(1970, 1, 1) }; static inline QDate fixedDate(int y, int m, int d) @@ -2321,8 +2322,8 @@ void QDateTime::setTimeSpec(Qt::TimeSpec spec) qint64 toMSecsSinceEpoch_helper(qint64 jd, int msecs) { - int days = jd - julianDayFromGregorianDate(1970, 1, 1); - qint64 retval = (qlonglong(days) * MSECS_PER_DAY) + msecs; + qint64 days = jd - JULIAN_DAY_FOR_EPOCH; + qint64 retval = (days * MSECS_PER_DAY) + msecs; return retval; } @@ -4017,7 +4018,7 @@ static void localToUtc(QDate &date, QTime &time, int isdst) localTM.tm_year = fakeDate.year() - 1900; localTM.tm_isdst = (int)isdst; #if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) - time_t secsSince1Jan1970UTC = toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)); + time_t secsSince1Jan1970UTC = (toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)) / 1000); #else #if defined(Q_OS_WIN) _tzset(); |