Issue #40: Finish

This commit is contained in:
Jakub Melka
2023-02-26 15:54:19 +01:00
parent 361ee247e5
commit edf7642151
3 changed files with 43 additions and 1 deletions

View File

@ -320,6 +320,7 @@ PDFProgramController::PDFProgramController(QObject* parent) :
m_recentFileManager(new PDFRecentFileManager(this)),
m_optionalContentActivity(nullptr),
m_textToSpeech(nullptr),
m_isDocumentSetInProgress(false),
m_futureWatcher(nullptr),
m_CMSManager(new pdf::PDFCMSManager(this)),
m_toolManager(nullptr),
@ -1670,6 +1671,7 @@ void PDFProgramController::onDocumentModified(pdf::PDFModifiedDocument document)
// We will create undo/redo step from old document, with flags from the new,
// because new document is modification of old document with flags.
pdf::PDFBoolGuard guard(m_isDocumentSetInProgress);
Q_ASSERT(m_pdfDocument);
if (m_undoRedoManager)
@ -1677,6 +1679,12 @@ void PDFProgramController::onDocumentModified(pdf::PDFModifiedDocument document)
m_undoRedoManager->createUndo(document, m_pdfDocument);
}
// Retain pointer on old document, because during the update,
// old pointer must be valid, because some widgets holds raw
// pointer.
pdf::PDFDocumentPointer oldDocument = std::move(m_pdfDocument);
Q_UNUSED(oldDocument);
m_pdfDocument = document;
document.setOptionalContentActivity(m_optionalContentActivity);
setDocument(document);
@ -2015,7 +2023,10 @@ void PDFProgramController::onActionCertificateManagerTriggered()
void PDFProgramController::onDrawSpaceChanged()
{
m_mainWindowInterface->updateUI(false);
if (!m_isDocumentSetInProgress)
{
m_mainWindowInterface->updateUI(false);
}
}
void PDFProgramController::onPageLayoutChanged()