Prevent crash when closing Qt Creator while cdb session is running.

The debugger plugin opens an editor in this case, leading to fakevim and
cppeditor crashing.
This commit doesn't fix the problem's source, but adds safeguards that
are sensible anyhow: FakeVim should not register with editors during
shutdown, and CppEditor should not unconditionally assume an existing
editor manager in the destructor.

Reviewed-by: Friedemann Kleint
This commit is contained in:
con
2010-10-20 17:10:47 +02:00
parent ffbbca4cc6
commit 0d5211cc45
3 changed files with 13 additions and 1 deletions

View File

@@ -491,6 +491,7 @@ public:
friend class FakeVimExCommandsPage;
bool initialize();
void onCoreAboutToClose();
void aboutToShutdown();
private slots:
@@ -586,6 +587,13 @@ FakeVimPluginPrivate::~FakeVimPluginPrivate()
m_fakeVimExCommandsPage = 0;
}
void FakeVimPluginPrivate::onCoreAboutToClose()
{
// don't attach to editors any more
disconnect(editorManager(), SIGNAL(editorOpened(Core::IEditor*)),
this, SLOT(editorOpened(Core::IEditor*)));
}
void FakeVimPluginPrivate::aboutToShutdown()
{
theFakeVimSettings()->writeSettings(ICore::instance()->settings());
@@ -618,6 +626,8 @@ bool FakeVimPluginPrivate::initialize()
actionManager()->actionContainer(Core::Constants::M_EDIT_ADVANCED);
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_EDITOR);
connect(m_core, SIGNAL(coreAboutToClose()), this, SLOT(onCoreAboutToClose()));
// EditorManager
connect(editorManager(), SIGNAL(editorAboutToClose(Core::IEditor*)),
this, SLOT(editorAboutToClose(Core::IEditor*)));