aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qtsupport/uicgenerator.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2024-02-26 10:28:28 +0100
committerhjk <hjk@qt.io>2024-02-26 11:57:23 +0000
commitb5e03b8fe2ce7bfe3ef782591bf19a6e452ef32d (patch)
tree09c099b4587b4d8ceda868c2f31649a778178f4a /src/plugins/qtsupport/uicgenerator.cpp
parentb10df4c1b3cdb0d2d9c36a0655af95085abe615e (diff)
QtSupport: Reduce ExtraCompiler life time to plugin life time again
Amends 6467797af2. The created extra compilers were parented to their factories, who gained a life time extension from 'end of plugin live' to static destruction when the factories were made static. However, this that time the likewise static QObjectCache in GeneratedCodeModelSupport::update might be destroyed already, leading to a potential crash in m_cache.remove(dead). This change here re-establishes the original timing by using the plugin itself as parent for the extra compilers. Change-Id: Id868b7b87f00440c67af551b71359c47a5c29cba Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/plugins/qtsupport/uicgenerator.cpp')
-rw-r--r--src/plugins/qtsupport/uicgenerator.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/qtsupport/uicgenerator.cpp b/src/plugins/qtsupport/uicgenerator.cpp
index dee12b9f9c..74b8355af9 100644
--- a/src/plugins/qtsupport/uicgenerator.cpp
+++ b/src/plugins/qtsupport/uicgenerator.cpp
@@ -72,8 +72,9 @@ FileNameToContentsHash UicGenerator::handleProcessFinished(Process *process)
class UicGeneratorFactory final : public ExtraCompilerFactory
{
public:
- UicGeneratorFactory() = default;
+ explicit UicGeneratorFactory(QObject *guard) : m_guard(guard) {}
+private:
FileType sourceType() const final { return FileType::Form; }
QString sourceTag() const final { return QLatin1String("ui"); }
@@ -82,13 +83,15 @@ public:
const FilePath &source,
const FilePaths &targets) final
{
- return new UicGenerator(project, source, targets, this);
+ return new UicGenerator(project, source, targets, m_guard);
}
+
+ QObject *m_guard;
};
-void setupUicGenerator()
+void setupUicGenerator(QObject *guard)
{
- static UicGeneratorFactory theUicGeneratorFactory;
+ static UicGeneratorFactory theUicGeneratorFactory(guard);
}
} // QtSupport::Internal