aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2016-08-09 15:26:41 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-08-09 16:08:33 +0000
commitfa99390154844307448dd21dc3d56543349d3891 (patch)
tree83425adcd57281e364b1b6552182551f12c5861c /src/qml/qml/qqmltypeloader.cpp
parent28a055ce33a72651ae8a55bc673a26a6999c30ff (diff)
Centralized deferred cleanup handling
Move the lambda cleanup code into a shared header file for re-use. Change-Id: Ib9fb7dce98200bcad2bb688740f9b6c2a1e4aae7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r--src/qml/qml/qqmltypeloader.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 75bc98f278..b7154625ee 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -51,6 +51,7 @@
#include <private/qqmltypecompiler_p.h>
#include <private/qqmlpropertyvalidator_p.h>
#include <private/qqmlpropertycachecreator_p.h>
+#include <private/qdeferredcleanup_p.h>
#include <QtCore/qdir.h>
#include <QtCore/qfile.h>
@@ -130,18 +131,6 @@ namespace {
LockHolder(LockType *l) : lock(*l) { lock.lock(); }
~LockHolder() { lock.unlock(); }
};
-
- struct Defer
- {
- std::function<void()> callback;
- template <typename Callback>
- Defer(Callback &&cb)
- : callback(cb)
- {}
- ~Defer() { callback(); }
- Defer(const Defer &) = delete;
- Defer &operator=(const Defer &) = delete;
- };
}
#ifndef QT_NO_NETWORK
@@ -2172,7 +2161,7 @@ void QQmlTypeData::createTypeAndPropertyCaches(const QQmlRefPointer<QQmlTypeName
void QQmlTypeData::done()
{
- Defer cleanup([this]{
+ QDeferredCleanup cleanup([this]{
m_document.reset();
m_typeReferences.clear();
if (isError())