summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2018-04-26 10:44:49 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2018-04-26 19:55:13 +0000
commit44e398f64ebe2841d5448076ed83f9886ab1b48f (patch)
treef101750dbd75d6230de84a7eb29d90953f127bf6 /examples
parent4b27062f5fae891850fd0f048f2a2421ca9b6c7c (diff)
Clarify ownership around QQmlEngine::setNAMF
We were leaking an instance of MyNetworkAccessManagerFactory in the "NetworkAccessManagerFactory"-example. To add to this the documentation around QQmlEngine::setNetworkAccessManagerFactory did not specify whether or not it took ownership, causing confusion. Change-Id: Ic9eee2c45682c752bcb4aa98943fc0af2b630795 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/qml/networkaccessmanagerfactory/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/qml/networkaccessmanagerfactory/main.cpp b/examples/qml/networkaccessmanagerfactory/main.cpp
index 95dfb5990d..a0fddf50c6 100644
--- a/examples/qml/networkaccessmanagerfactory/main.cpp
+++ b/examples/qml/networkaccessmanagerfactory/main.cpp
@@ -133,7 +133,8 @@ int main(int argc, char ** argv)
source = QUrl::fromLocalFile(parser.positionalArguments().first());
QQuickView view;
- view.engine()->setNetworkAccessManagerFactory(new MyNetworkAccessManagerFactory);
+ MyNetworkAccessManagerFactory networkManagerFactory;
+ view.engine()->setNetworkAccessManagerFactory(&networkManagerFactory);
view.setSource(source);
view.show();