aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-08-12 14:11:28 +0200
committerEike Ziller <eike.ziller@qt.io>2020-08-14 07:45:43 +0000
commitbd6161e2b2b2fea729e1250d9837b31e3562b6e5 (patch)
tree3915cc55169084acd63d65194106406623670fd9 /src/libs
parent1e09b01d0ed9133c8926e658feda599e900beec5 (diff)
ExtensionSystem: Add option to skip startup crash check
It can lead to problems, especially in automated environments, so provide an option to skip it. Task-number: QTCREATORBUG-24294 Change-Id: Ided0d12a87dc60fcaee6ad7e2747982cb0806a8f Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/extensionsystem/optionsparser.cpp11
-rw-r--r--src/libs/extensionsystem/optionsparser.h3
-rw-r--r--src/libs/extensionsystem/pluginmanager.cpp13
-rw-r--r--src/libs/extensionsystem/pluginmanager_p.h1
4 files changed, 27 insertions, 1 deletions
diff --git a/src/libs/extensionsystem/optionsparser.cpp b/src/libs/extensionsystem/optionsparser.cpp
index ecac59e5bf1..29e790c8d7c 100644
--- a/src/libs/extensionsystem/optionsparser.cpp
+++ b/src/libs/extensionsystem/optionsparser.cpp
@@ -42,6 +42,7 @@ const char *OptionsParser::LOAD_OPTION = "-load";
const char *OptionsParser::TEST_OPTION = "-test";
const char *OptionsParser::NOTEST_OPTION = "-notest";
const char *OptionsParser::PROFILE_OPTION = "-profile";
+const char *OptionsParser::NO_CRASHCHECK_OPTION = "-no-crashcheck";
OptionsParser::OptionsParser(const QStringList &args,
const QMap<QString, bool> &appOptions,
@@ -79,6 +80,8 @@ bool OptionsParser::parse()
continue;
if (checkForProfilingOption())
continue;
+ if (checkForNoCrashcheckOption())
+ continue;
#ifdef WITH_TESTS
if (checkForTestOptions())
continue;
@@ -243,6 +246,14 @@ bool OptionsParser::checkForProfilingOption()
return true;
}
+bool OptionsParser::checkForNoCrashcheckOption()
+{
+ if (m_currentArg != QLatin1String(NO_CRASHCHECK_OPTION))
+ return false;
+ m_pmPrivate->enableCrashCheck = false;
+ return true;
+}
+
bool OptionsParser::checkForPluginOption()
{
bool requiresParameter;
diff --git a/src/libs/extensionsystem/optionsparser.h b/src/libs/extensionsystem/optionsparser.h
index a33486e9513..80706aecea5 100644
--- a/src/libs/extensionsystem/optionsparser.h
+++ b/src/libs/extensionsystem/optionsparser.h
@@ -49,6 +49,8 @@ public:
static const char *TEST_OPTION;
static const char *NOTEST_OPTION;
static const char *PROFILE_OPTION;
+ static const char *NO_CRASHCHECK_OPTION;
+
private:
// return value indicates if the option was processed
// it doesn't indicate success (--> m_hasError)
@@ -59,6 +61,7 @@ private:
bool checkForAppOption();
bool checkForPluginOption();
bool checkForProfilingOption();
+ bool checkForNoCrashcheckOption();
bool checkForUnknownOption();
void forceDisableAllPluginsExceptTestedAndForceEnabled();
diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp
index 2f804004a54..8edbc57c0f3 100644
--- a/src/libs/extensionsystem/pluginmanager.cpp
+++ b/src/libs/extensionsystem/pluginmanager.cpp
@@ -64,6 +64,7 @@
#endif
#include <functional>
+#include <memory>
Q_LOGGING_CATEGORY(pluginLog, "qtc.extensionsystem", QtWarningMsg)
@@ -729,6 +730,12 @@ void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int d
formatOption(str, QLatin1String(OptionsParser::PROFILE_OPTION),
QString(), QLatin1String("Profile plugin loading"),
optionIndentation, descriptionIndentation);
+ formatOption(str,
+ QLatin1String(OptionsParser::NO_CRASHCHECK_OPTION),
+ QString(),
+ QLatin1String("Disable startup check for previously crashed instance"),
+ optionIndentation,
+ descriptionIndentation);
#ifdef WITH_TESTS
formatOption(str, QString::fromLatin1(OptionsParser::TEST_OPTION)
+ QLatin1String(" <plugin>[,testfunction[:testdata]]..."), QString(),
@@ -1409,6 +1416,8 @@ private:
void PluginManagerPrivate::checkForProblematicPlugins()
{
+ if (!enableCrashCheck)
+ return;
const Utils::optional<QString> pluginName = LockFile::lockedPluginName(this);
if (pluginName) {
PluginSpec *spec = pluginByName(*pluginName);
@@ -1464,7 +1473,9 @@ void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destSt
if (!spec->isEffectivelyEnabled() && destState == PluginSpec::Loaded)
return;
- LockFile f(this, spec);
+ std::unique_ptr<LockFile> lockFile;
+ if (enableCrashCheck)
+ lockFile.reset(new LockFile(this, spec));
switch (destState) {
case PluginSpec::Running:
diff --git a/src/libs/extensionsystem/pluginmanager_p.h b/src/libs/extensionsystem/pluginmanager_p.h
index bafddf9d446..6f5dbe50e30 100644
--- a/src/libs/extensionsystem/pluginmanager_p.h
+++ b/src/libs/extensionsystem/pluginmanager_p.h
@@ -138,6 +138,7 @@ public:
mutable QReadWriteLock m_lock;
bool m_isInitializationDone = false;
+ bool enableCrashCheck = true;
private:
PluginManager *q;