forked from qt-creator/qt-creator
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:
@@ -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*)));
|
||||
|
||||
Reference in New Issue
Block a user