From 1b7fba2f78bfc410861de68c1ec3858436fdb25a Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Mon, 9 Dec 2019 19:24:27 +0100 Subject: [PATCH] Fix crash after opening document --- PdfForQtLib/sources/pdfitemmodels.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PdfForQtLib/sources/pdfitemmodels.cpp b/PdfForQtLib/sources/pdfitemmodels.cpp index 19401dd..d9cb69e 100644 --- a/PdfForQtLib/sources/pdfitemmodels.cpp +++ b/PdfForQtLib/sources/pdfitemmodels.cpp @@ -731,6 +731,7 @@ void PDFThumbnailsItemModel::setDocument(const PDFDocument* document) { if (m_document != document) { + beginResetModel(); m_thumbnailCache.clear(); m_document = document; @@ -739,6 +740,7 @@ void PDFThumbnailsItemModel::setDocument(const PDFDocument* document) { m_pageCount = static_cast(m_document->getCatalog()->getPageCount()); } + endResetModel(); } }