Designer: Fix a crash when open() fails.

editorsClosed() is not emitted when open fails and thus
the file was not removed from FormEditorStack.
Add a connection from destroy to ensure the editor is removed.

Happens when loading a session whose files no longer exists.

Task-number: QTCREATORBUG-4266
Reviewed-by: dt
This commit is contained in:
Friedemann Kleint
2011-03-30 11:52:15 +02:00
parent b38a256ed6
commit 776c599384
4 changed files with 28 additions and 19 deletions

View File

@@ -66,7 +66,6 @@ public:
explicit FormEditorStack(QWidget *parent = 0);
void add(const EditorData &d);
bool removeFormWindowEditor(Core::IEditor *xmlEditor);
bool setVisibleEditor(Core::IEditor *xmlEditor);
SharedTools::WidgetHost *formWindowEditorForXmlEditor(const Core::IEditor *xmlEditor) const;
@@ -74,14 +73,17 @@ public:
EditorData activeEditor() const;
public slots:
void removeFormWindowEditor(QObject *);
private slots:
void updateFormWindowSelectionHandles();
void modeAboutToChange(Core::IMode *);
void formSizeChanged(int w, int h);
private:
inline int indexOf(const QDesignerFormWindowInterface *) const;
inline int indexOf(const Core::IEditor *xmlEditor) const;
inline int indexOfFormWindow(const QDesignerFormWindowInterface *) const;
inline int indexOfFormEditor(const QObject *xmlEditor) const;
QList<EditorData> m_formEditors;
QDesignerFormEditorInterface *m_designerCore;