diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-03-15 13:52:07 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-03-19 10:37:31 +0000 |
commit | e1d32c80665c7d90a21138b26cb74dbfc86a63ba (patch) | |
tree | 05a84dac95b4d4a0a19dff34f10cea98aac5f627 /tools | |
parent | 958e412a25523cc031564faae81c569aa6c3b01f (diff) |
Fix CONFIG+=qtquickcompiler with Q_CLEANUP_RESOURCE
As we provide the init resources wrapper, we must also provide the
cleanup wrapper.
Change-Id: I7e45ae48ba955e70ffd8e253d4d2c15d0a50dabe
Task-number: QTBUG-67087
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmlcachegen/generateloader.cpp | 14 |
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"; } } |