aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/qmlcachegen/generateloader.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/qmlcachegen/generateloader.cpp b/tools/qmlcachegen/generateloader.cpp
index 1a0b987c64..a2e673d15a 100644
--- a/tools/qmlcachegen/generateloader.cpp
+++ b/tools/qmlcachegen/generateloader.cpp
@@ -358,15 +358,23 @@ bool generateLoader(const QStringList &compiledFiles, const QString &outputFileN
originalResourceFile.truncate(mappingSplit);
}
- const QString function = QLatin1String("qInitResources_") + qtResourceNameForFile(originalResourceFile);
+ const QString suffix = qtResourceNameForFile(originalResourceFile);
+ const QString initFunction = QLatin1String("qInitResources_") + suffix;
- stream << QStringLiteral("int QT_MANGLE_NAMESPACE(%1)() {\n").arg(function);
+ stream << QStringLiteral("int QT_MANGLE_NAMESPACE(%1)() {\n").arg(initFunction);
stream << " ::unitRegistry();\n";
if (!newResourceFile.isEmpty())
stream << " Q_INIT_RESOURCE(" << qtResourceNameForFile(newResourceFile) << ");\n";
stream << " return 1;\n";
stream << "}\n";
- stream << "Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(" << function << "));\n";
+ stream << "Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(" << initFunction << "));\n";
+
+ const QString cleanupFunction = QLatin1String("qCleanupResources_") + suffix;
+ stream << QStringLiteral("int QT_MANGLE_NAMESPACE(%1)() {\n").arg(cleanupFunction);
+ if (!newResourceFile.isEmpty())
+ stream << " Q_CLEANUP_RESOURCE(" << qtResourceNameForFile(newResourceFile) << ");\n";
+ stream << " return 1;\n";
+ stream << "}\n";
}
}