PluginManager: Write plugin id, not name, to startup check

We write information about the currently "starting" plugin, so if that
crashes we notice that at the next startup and ask the user if they
really want to try to load that plugin again.

Nowadays we must write the id(), not the name() anymore.

Change-Id: Ibdee163eb5d58820347f6e8e11b8a3d4f29ff53a
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Eike Ziller
2024-12-13 12:42:23 +01:00
parent 55b75f7045
commit 01e308b2cc

View File

@@ -1622,7 +1622,7 @@ public:
QDir().mkpath(QFileInfo(m_filePath).absolutePath()); QDir().mkpath(QFileInfo(m_filePath).absolutePath());
QFile f(m_filePath); QFile f(m_filePath);
if (f.open(QIODevice::WriteOnly)) { if (f.open(QIODevice::WriteOnly)) {
f.write(spec->name().toUtf8()); f.write(spec->id().toUtf8());
f.write("\n"); f.write("\n");
f.close(); f.close();
} else { } else {
@@ -1933,9 +1933,11 @@ PluginSpec *PluginManagerPrivate::pluginForOption(const QString &option, bool *r
return nullptr; return nullptr;
} }
PluginSpec *PluginManagerPrivate::pluginById(const QString &id) const PluginSpec *PluginManagerPrivate::pluginById(const QString &id_in) const
{ {
QTC_CHECK(id.isLower()); // Plugin ids are always lower case. So the id argument should be too. QString id = id_in;
// Plugin ids are always lower case. So the id argument should be too.
QTC_ASSERT(id.isLower(), id = id.toLower());
return Utils::findOrDefault(pluginSpecs, [id](PluginSpec *spec) { return spec->id() == id; }); return Utils::findOrDefault(pluginSpecs, [id](PluginSpec *spec) { return spec->id() == id; });
} }