summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qeventdispatcher_symbian.cpp
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-01-07 15:57:28 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-01-10 10:47:55 (GMT)
commit2b1b617664bfc78f6e95e53dc0f9749bd1f2d27a (patch)
tree7231535f2fd19987c9143cc581468bb5769b0271 /src/corelib/kernel/qeventdispatcher_symbian.cpp
parent6e6bdedd06c72f857590b32462548448da6d59b5 (diff)
downloadQt-2b1b617664bfc78f6e95e53dc0f9749bd1f2d27a.zip
Qt-2b1b617664bfc78f6e95e53dc0f9749bd1f2d27a.tar.gz
Qt-2b1b617664bfc78f6e95e53dc0f9749bd1f2d27a.tar.bz2
Fix handle leak in symbian QTimer implementation
The timer handle was only being closed when a timer was cancelled, which resulted in a leak for one shot timers that have completed normally. Instead the timer is now closed in a destructor (closing null handles is safe, so it doesn't matter if the handle was never created - e.g. in the case of a zero timer) Also added a handle check before creating a timer to prevent a leak in case the start function is called twice in the backend. Task-number: QTBUG-16380 Reviewed-by: mread
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_symbian.cpp')
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index bb9bd01..99c4087 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -217,13 +217,13 @@ QTimerActiveObject::QTimerActiveObject(QEventDispatcherSymbian *dispatcher, Symb
QTimerActiveObject::~QTimerActiveObject()
{
Cancel();
+ m_rTimer.Close(); //close of null handle is safe
}
void QTimerActiveObject::DoCancel()
{
if (m_timerInfo->interval > 0) {
m_rTimer.Cancel();
- m_rTimer.Close();
} else {
if (iStatus.Int() == KRequestPending) {
TRequestStatus *status = &iStatus;
@@ -302,7 +302,9 @@ void QTimerActiveObject::Start()
CActiveScheduler::Add(this);
m_timerInfo->msLeft = m_timerInfo->interval;
if (m_timerInfo->interval > 0) {
- m_rTimer.CreateLocal();
+ if (!m_rTimer.Handle()) {
+ qt_symbian_throwIfError(m_rTimer.CreateLocal());
+ }
StartTimer();
} else {
iStatus = KRequestPending;