Qt Designer: Fix a crash when closing form while building.

Task-number: QTCREATORBUG-1092
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Friedemann Kleint
2010-04-08 15:38:03 +02:00
parent 5892049d65
commit 7ed80f1656
2 changed files with 15 additions and 0 deletions

View File

@@ -35,6 +35,7 @@
#include <utils/qtcassert.h>
#include <QtDesigner/QDesignerFormWindowInterface>
#include <QtDesigner/QDesignerFormWindowManagerInterface>
#include <QtDesigner/QDesignerFormEditorInterface>
#include <QtGui/QMessageBox>
@@ -53,6 +54,8 @@ FormWindowFile::FormWindowFile(QDesignerFormWindowInterface *form, QObject *pare
m_mimeType(QLatin1String(Designer::Constants::FORM_MIMETYPE)),
m_formWindow(form)
{
connect(m_formWindow->core()->formWindowManager(), SIGNAL(formWindowRemoved(QDesignerFormWindowInterface*)),
this, SLOT(slotFormWindowRemoved(QDesignerFormWindowInterface*)));
}
bool FormWindowFile::save(const QString &name /*= QString()*/)
@@ -192,5 +195,14 @@ QDesignerFormWindowInterface *FormWindowFile::formWindow() const
return m_formWindow;
}
void FormWindowFile::slotFormWindowRemoved(QDesignerFormWindowInterface *w)
{
// Release formwindow as soon as the FormWindowManager removes
// as calls to isDirty() are triggered at arbitrary times
// while building.
if (w == m_formWindow)
m_formWindow = 0;
}
} // namespace Internal
} // namespace Designer