From 7990fab708c153545ffef6a5af3be49905b9d705 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Fri, 10 Apr 2015 18:09:33 +1000 Subject: [PATCH] Fix crash when exiting via window manager on some systems. --- apps/opencs/model/world/idtree.cpp | 3 +-- apps/opencs/model/world/idtree.hpp | 1 - apps/opencs/view/doc/view.cpp | 4 ++++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/opencs/model/world/idtree.cpp b/apps/opencs/model/world/idtree.cpp index 4befd1eee..952c9e329 100644 --- a/apps/opencs/model/world/idtree.cpp +++ b/apps/opencs/model/world/idtree.cpp @@ -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 { - // FIXME: workaround only, a proper fix should stop QHideEvent calls after destruction - if (section < 0 || !idCollection() || section >= idCollection()->getColumns()) + if (section < 0 || section >= idCollection()->getColumns()) return QVariant(); const NestableColumn *parentColumn = mNestedCollection->getNestableColumn(section); diff --git a/apps/opencs/model/world/idtree.hpp b/apps/opencs/model/world/idtree.hpp index d06d86a4f..5f005c4d3 100644 --- a/apps/opencs/model/world/idtree.hpp +++ b/apps/opencs/model/world/idtree.hpp @@ -61,7 +61,6 @@ namespace CSMWorld 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; NestedTableWrapperBase* nestedTable(const QModelIndex &index) const; diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index cf2940b99..f9fe613ef 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -32,6 +32,10 @@ void CSVDoc::View::closeEvent (QCloseEvent *event) event->ignore(); else { + // delete the subviews first + for (QList::iterator iter = mSubViews.begin(); iter != mSubViews.end(); ++iter) + delete *iter; + // closeRequest() returns true if last document mViewManager.removeDocAndView(mDocument); }