aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-10-15 14:08:02 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2019-10-16 08:16:23 +0000
commite90a48e639af0c4a01f78a78ca3b33aef4f0a114 (patch)
tree0cc8e8fb44ee1776bf1ed6b309833f595c9f1d90
parent42fba8ee3bee257974058e2c41f38f6dd77c6e23 (diff)
ProjectExplorer: Fix some problems with plugin unloading
It was not possible to return false from ProjectExplorerPlugin::initialize() without triggering crashes. Change-Id: I96b2f80c835e69769f64f9b9c61f473e9ff88623 Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/plugins/coreplugin/fancyactionbar.cpp4
-rw-r--r--src/plugins/coreplugin/modemanager.cpp3
-rw-r--r--src/plugins/coreplugin/outputpanemanager.cpp1
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp2
-rw-r--r--src/plugins/projectexplorer/session.cpp2
-rw-r--r--src/plugins/welcome/welcomeplugin.cpp7
6 files changed, 17 insertions, 2 deletions
diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp
index 03f28778f6..284b68fdae 100644
--- a/src/plugins/coreplugin/fancyactionbar.cpp
+++ b/src/plugins/coreplugin/fancyactionbar.cpp
@@ -176,7 +176,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
: QIcon::Disabled;
QRect iconRect(0, 0, Constants::MODEBAR_ICON_SIZE, Constants::MODEBAR_ICON_SIZE);
- const bool isTitledAction = defaultAction()->property("titledAction").toBool();
+ const bool isTitledAction = defaultAction() && defaultAction()->property("titledAction").toBool();
// draw popup texts
if (isTitledAction && !m_iconsOnly) {
QFont normalFont(painter.font());
@@ -286,7 +286,7 @@ QSize FancyToolButton::sizeHint() const
}
QSizeF buttonSize = iconSize().expandedTo(QSize(64, 38));
- if (defaultAction()->property("titledAction").toBool()) {
+ if (defaultAction() && defaultAction()->property("titledAction").toBool()) {
QFont boldFont(font());
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
boldFont.setBold(true);
diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp
index be69338372..536c6e4714 100644
--- a/src/plugins/coreplugin/modemanager.cpp
+++ b/src/plugins/coreplugin/modemanager.cpp
@@ -238,6 +238,9 @@ void ModeManager::removeMode(IMode *mode)
{
const int index = d->m_modes.indexOf(mode);
d->m_modes.remove(index);
+ if (d->m_startingUp)
+ return;
+
d->m_modeCommands.remove(index);
d->m_modeStack->removeTab(index);
diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp
index b0153eda50..31af49521f 100644
--- a/src/plugins/coreplugin/outputpanemanager.cpp
+++ b/src/plugins/coreplugin/outputpanemanager.cpp
@@ -115,6 +115,7 @@ IOutputPane::~IOutputPane()
const int i = Utils::indexOf(g_outputPanes, Utils::equal(&OutputPaneData::pane, this));
QTC_ASSERT(i >= 0, return);
delete g_outputPanes.at(i).button;
+ g_outputPanes.removeAt(i);
delete m_zoomInButton;
delete m_zoomOutButton;
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index d76271c07f..439e5f03a5 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -2772,6 +2772,8 @@ QPair<bool, QString> ProjectExplorerPluginPrivate::buildSettingsEnabledForSessio
bool ProjectExplorerPlugin::coreAboutToClose()
{
+ if (!m_instance)
+ return true;
if (BuildManager::isBuilding()) {
QMessageBox box;
QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Close"), QMessageBox::AcceptRole);
diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp
index 036f7faff1..f224bce49e 100644
--- a/src/plugins/projectexplorer/session.cpp
+++ b/src/plugins/projectexplorer/session.cpp
@@ -156,6 +156,8 @@ SessionManager::SessionManager(QObject *parent) : QObject(parent)
SessionManager::~SessionManager()
{
+ EditorManager::setWindowTitleAdditionHandler({});
+ EditorManager::setSessionTitleHandler({});
emit m_instance->aboutToUnloadSession(d->m_sessionName);
delete d->m_writer;
delete d;
diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp
index 08e763ab09..d60e7adf9c 100644
--- a/src/plugins/welcome/welcomeplugin.cpp
+++ b/src/plugins/welcome/welcomeplugin.cpp
@@ -429,6 +429,13 @@ void WelcomeMode::addPage(IWelcomePage *page)
stackPage->setAutoFillBackground(true);
m_pageStack->insertWidget(idx, stackPage);
+ connect(page, &QObject::destroyed, this, [this, page, stackPage, pageButton] {
+ m_pluginList.removeOne(page);
+ m_pageButtons.removeOne(pageButton);
+ delete pageButton;
+ delete stackPage;
+ });
+
auto onClicked = [this, pageId, stackPage] {
m_activePage = pageId;
m_pageStack->setCurrentWidget(stackPage);