From 0413d538574202034b04e07260702c5e49afe64e Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 15 Jan 2013 01:16:35 +0100 Subject: [PATCH] Delete the oldModel even if the new doc has no toc BUGS: 313146 --- ui/toc.cpp | 8 -------- ui/tocmodel.cpp | 6 +++++- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ui/toc.cpp b/ui/toc.cpp index c1659bdc7..7e284f380 100644 --- a/ui/toc.cpp +++ b/ui/toc.cpp @@ -73,14 +73,6 @@ void TOC::notifySetup( const QVector< Okular::Page * > & /*pages*/, int setupFla // request synopsis description (is a dom tree) const Okular::DocumentSynopsis * syn = m_document->documentSynopsis(); - // if not present, disable the contents tab - if ( !syn ) - { - emit hasTOC( false ); - return; - } - - // else populate the listview and enable the tab m_model->fill( syn ); emit hasTOC( !m_model->isEmpty() ); } diff --git a/ui/tocmodel.cpp b/ui/tocmodel.cpp index 214a21844..2fc9a205b 100644 --- a/ui/tocmodel.cpp +++ b/ui/tocmodel.cpp @@ -266,8 +266,12 @@ static QModelIndex indexForIndex( const QModelIndex &oldModelIndex, QAbstractIte void TOCModel::fill( const Okular::DocumentSynopsis *toc ) { - if ( !toc ) + if ( !toc ) { + delete d->m_oldModel; + d->m_oldModel = 0; + d->m_oldTocExpandedIndexes.clear(); return; + } clear(); emit layoutAboutToBeChanged();