aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlfileselector.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-20 16:46:28 +0200
committerHolger Freyther <holger+qt@freyther.de>2014-07-21 08:05:57 +0200
commit23e506fb3ea393e6ed1698923094000d6b640dac (patch)
tree2c3df8c112771d3292e19f2df35debd877fbc9ad /src/qml/qml/qqmlfileselector.cpp
parenta62955472b2acd644db46ea194d4fb0bc119150f (diff)
qml: Fix potential memory leak in the file selector
The myInstance doesn't seem to be part of a QObject parent/child relationship and Coverity complained about it. Use a QScopedPointer to make sure the data will be deleted. Fixes: CID 10606 Change-Id: I30848ab4d1e621d82281aaa7d6f84e0c2cce4084 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlfileselector.cpp')
-rw-r--r--src/qml/qml/qqmlfileselector.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlfileselector.cpp b/src/qml/qml/qqmlfileselector.cpp
index 187c3656c6..8498a4d67d 100644
--- a/src/qml/qml/qqmlfileselector.cpp
+++ b/src/qml/qml/qqmlfileselector.cpp
@@ -106,8 +106,8 @@ QQmlFileSelector::QQmlFileSelector(QQmlEngine* engine, QObject* parent)
{
Q_D(QQmlFileSelector);
d->engine = engine;
- interceptorInstances()->insert(d->myInstance, this);
- d->engine->setUrlInterceptor(d->myInstance);
+ interceptorInstances()->insert(d->myInstance.data(), this);
+ d->engine->setUrlInterceptor(d->myInstance.data());
}
QQmlFileSelector::~QQmlFileSelector()
@@ -117,7 +117,7 @@ QQmlFileSelector::~QQmlFileSelector()
d->engine->setUrlInterceptor(0);
d->engine = 0;
}
- interceptorInstances()->remove(d->myInstance);
+ interceptorInstances()->remove(d->myInstance.data());
}
QQmlFileSelectorPrivate::QQmlFileSelectorPrivate()
@@ -125,7 +125,7 @@ QQmlFileSelectorPrivate::QQmlFileSelectorPrivate()
Q_Q(QQmlFileSelector);
ownSelector = true;
selector = new QFileSelector(q);
- myInstance = new QQmlFileSelectorInterceptor(this);
+ myInstance.reset(new QQmlFileSelectorInterceptor(this));
}
/*!