Fix crash when exiting via window manager on some systems.

This commit is contained in:
cc9cii 2015-04-10 18:09:33 +10:00
parent 9a564f5062
commit 7990fab708
3 changed files with 5 additions and 3 deletions

View file

@ -54,8 +54,7 @@ QVariant CSMWorld::IdTree::data (const QModelIndex & index, int role) const
QVariant CSMWorld::IdTree::nestedHeaderData(int section, int subSection, Qt::Orientation orientation, int role) const QVariant CSMWorld::IdTree::nestedHeaderData(int section, int subSection, Qt::Orientation orientation, int role) const
{ {
// FIXME: workaround only, a proper fix should stop QHideEvent calls after destruction if (section < 0 || section >= idCollection()->getColumns())
if (section < 0 || !idCollection() || section >= idCollection()->getColumns())
return QVariant(); return QVariant();
const NestableColumn *parentColumn = mNestedCollection->getNestableColumn(section); const NestableColumn *parentColumn = mNestedCollection->getNestableColumn(section);

View file

@ -61,7 +61,6 @@ namespace CSMWorld
virtual QModelIndex parent (const QModelIndex& index) const; virtual QModelIndex parent (const QModelIndex& index) const;
// TODO: check if below methods are really needed
QVariant nestedHeaderData(int section, int subSection, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QVariant nestedHeaderData(int section, int subSection, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
NestedTableWrapperBase* nestedTable(const QModelIndex &index) const; NestedTableWrapperBase* nestedTable(const QModelIndex &index) const;

View file

@ -32,6 +32,10 @@ void CSVDoc::View::closeEvent (QCloseEvent *event)
event->ignore(); event->ignore();
else else
{ {
// delete the subviews first
for (QList<CSVDoc::SubView *>::iterator iter = mSubViews.begin(); iter != mSubViews.end(); ++iter)
delete *iter;
// closeRequest() returns true if last document // closeRequest() returns true if last document
mViewManager.removeDocAndView(mDocument); mViewManager.removeDocAndView(mDocument);
} }