Commit dfa0c14f authored by dt's avatar dt
Browse files

Fix crash on unloading project that is building.

Task-Nr: QTCREATOR-7
parent e72517e4
......@@ -43,6 +43,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/progressmanager/futureprogress.h>
#include <projectexplorer/session.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
......@@ -84,6 +85,9 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent)
connect(&m_watcher, SIGNAL(progressRangeChanged(int, int)),
this, SLOT(progressChanged()));
connect(parent->session(), SIGNAL(aboutToRemoveProject(ProjectExplorer::Project *)),
this, SLOT(aboutToRemoveProject(ProjectExplorer::Project *)));
m_outputWindow = new CompileOutputWindow(this);
pm->addObject(m_outputWindow);
......@@ -114,6 +118,18 @@ BuildManager::~BuildManager()
delete m_outputWindow;
}
void BuildManager::aboutToRemoveProject(ProjectExplorer::Project *p)
{
QHash<Project *, int>::iterator it = m_activeBuildSteps.find(p);
QHash<Project *, int>::iterator end = m_activeBuildSteps.end();
if (it != end && *it > 0) {
// We are building the project that's about to be removed.
// We cancel the whole queue, which isn't the nicest thing to do
// but a safe thing.
cancel();
}
}
bool BuildManager::isBuilding() const
{
// we are building even if we are not running yet
......
......@@ -85,6 +85,7 @@ public slots:
void showTaskWindow();
void toggleTaskWindow();
void toggleOutputWindow();
void aboutToRemoveProject(ProjectExplorer::Project *p);
signals:
void buildStateChanged(ProjectExplorer::Project *pro);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment