forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -176,7 +176,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
|
|||||||
: QIcon::Disabled;
|
: QIcon::Disabled;
|
||||||
QRect iconRect(0, 0, Constants::MODEBAR_ICON_SIZE, Constants::MODEBAR_ICON_SIZE);
|
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
|
// draw popup texts
|
||||||
if (isTitledAction && !m_iconsOnly) {
|
if (isTitledAction && !m_iconsOnly) {
|
||||||
QFont normalFont(painter.font());
|
QFont normalFont(painter.font());
|
||||||
@@ -286,7 +286,7 @@ QSize FancyToolButton::sizeHint() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QSizeF buttonSize = iconSize().expandedTo(QSize(64, 38));
|
QSizeF buttonSize = iconSize().expandedTo(QSize(64, 38));
|
||||||
if (defaultAction()->property("titledAction").toBool()) {
|
if (defaultAction() && defaultAction()->property("titledAction").toBool()) {
|
||||||
QFont boldFont(font());
|
QFont boldFont(font());
|
||||||
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
|
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
|
||||||
boldFont.setBold(true);
|
boldFont.setBold(true);
|
||||||
|
@@ -238,6 +238,9 @@ void ModeManager::removeMode(IMode *mode)
|
|||||||
{
|
{
|
||||||
const int index = d->m_modes.indexOf(mode);
|
const int index = d->m_modes.indexOf(mode);
|
||||||
d->m_modes.remove(index);
|
d->m_modes.remove(index);
|
||||||
|
if (d->m_startingUp)
|
||||||
|
return;
|
||||||
|
|
||||||
d->m_modeCommands.remove(index);
|
d->m_modeCommands.remove(index);
|
||||||
d->m_modeStack->removeTab(index);
|
d->m_modeStack->removeTab(index);
|
||||||
|
|
||||||
|
@@ -115,6 +115,7 @@ IOutputPane::~IOutputPane()
|
|||||||
const int i = Utils::indexOf(g_outputPanes, Utils::equal(&OutputPaneData::pane, this));
|
const int i = Utils::indexOf(g_outputPanes, Utils::equal(&OutputPaneData::pane, this));
|
||||||
QTC_ASSERT(i >= 0, return);
|
QTC_ASSERT(i >= 0, return);
|
||||||
delete g_outputPanes.at(i).button;
|
delete g_outputPanes.at(i).button;
|
||||||
|
g_outputPanes.removeAt(i);
|
||||||
|
|
||||||
delete m_zoomInButton;
|
delete m_zoomInButton;
|
||||||
delete m_zoomOutButton;
|
delete m_zoomOutButton;
|
||||||
|
@@ -2772,6 +2772,8 @@ QPair<bool, QString> ProjectExplorerPluginPrivate::buildSettingsEnabledForSessio
|
|||||||
|
|
||||||
bool ProjectExplorerPlugin::coreAboutToClose()
|
bool ProjectExplorerPlugin::coreAboutToClose()
|
||||||
{
|
{
|
||||||
|
if (!m_instance)
|
||||||
|
return true;
|
||||||
if (BuildManager::isBuilding()) {
|
if (BuildManager::isBuilding()) {
|
||||||
QMessageBox box;
|
QMessageBox box;
|
||||||
QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Close"), QMessageBox::AcceptRole);
|
QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Close"), QMessageBox::AcceptRole);
|
||||||
|
@@ -156,6 +156,8 @@ SessionManager::SessionManager(QObject *parent) : QObject(parent)
|
|||||||
|
|
||||||
SessionManager::~SessionManager()
|
SessionManager::~SessionManager()
|
||||||
{
|
{
|
||||||
|
EditorManager::setWindowTitleAdditionHandler({});
|
||||||
|
EditorManager::setSessionTitleHandler({});
|
||||||
emit m_instance->aboutToUnloadSession(d->m_sessionName);
|
emit m_instance->aboutToUnloadSession(d->m_sessionName);
|
||||||
delete d->m_writer;
|
delete d->m_writer;
|
||||||
delete d;
|
delete d;
|
||||||
|
@@ -429,6 +429,13 @@ void WelcomeMode::addPage(IWelcomePage *page)
|
|||||||
stackPage->setAutoFillBackground(true);
|
stackPage->setAutoFillBackground(true);
|
||||||
m_pageStack->insertWidget(idx, stackPage);
|
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] {
|
auto onClicked = [this, pageId, stackPage] {
|
||||||
m_activePage = pageId;
|
m_activePage = pageId;
|
||||||
m_pageStack->setCurrentWidget(stackPage);
|
m_pageStack->setCurrentWidget(stackPage);
|
||||||
|
Reference in New Issue
Block a user