mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 03:30:20 +00:00
Don't attempt to restore old TOCModel if it hasn't been actually saved
Because if it hasn't been saved (54b4a20e07
)
this results in m_model == 0, which makes us crash.
This commit is contained in:
parent
77a71a021a
commit
80ebb46d36
|
@ -100,6 +100,9 @@ void TOC::prepareForReload()
|
|||
|
||||
void TOC::rollbackReload()
|
||||
{
|
||||
if( !m_model->hasOldModelData() )
|
||||
return;
|
||||
|
||||
TOCModel *m = m_model;
|
||||
m_model = m->clearOldModelData();
|
||||
delete m;
|
||||
|
|
|
@ -370,6 +370,11 @@ void TOCModel::setOldModelData( TOCModel *model, const QVector<QModelIndex> &lis
|
|||
d->m_oldTocExpandedIndexes = list;
|
||||
}
|
||||
|
||||
bool TOCModel::hasOldModelData() const
|
||||
{
|
||||
return (d->m_oldModel != 0);
|
||||
}
|
||||
|
||||
TOCModel *TOCModel::clearOldModelData() const
|
||||
{
|
||||
TOCModel *oldModel = d->m_oldModel;
|
||||
|
|
|
@ -45,6 +45,7 @@ class TOCModel : public QAbstractItemModel
|
|||
bool isEmpty() const;
|
||||
bool equals( const TOCModel *model ) const;
|
||||
void setOldModelData( TOCModel *model, const QVector<QModelIndex> &list );
|
||||
bool hasOldModelData() const;
|
||||
TOCModel *clearOldModelData() const;
|
||||
|
||||
QString externalFileNameForIndex( const QModelIndex &index ) const;
|
||||
|
|
Loading…
Reference in a new issue