From 055f2db76d58b559b8a215cd5713cdbd7265fddd Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 13 Nov 2017 14:39:50 +0100 Subject: [PATCH] Set back the autogenerated annotation unique name on saving The the original unique name was empty. Otherwise we can't find the annotation after save/reload because the annotation name is still empty and a new random id is assigned --- generators/poppler/generator_pdf.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp index 2cfbd895a..ff13fbf3f 100644 --- a/generators/poppler/generator_pdf.cpp +++ b/generators/poppler/generator_pdf.cpp @@ -1717,6 +1717,18 @@ bool PDFGenerator::save( const QString &fileName, SaveOptions options, QString * pdfConv->setPDFOptions( pdfConv->pdfOptions() | Poppler::PDFConverter::WithChanges ); QMutexLocker locker( userMutex() ); + + QHashIterator it( annotationsHash ); + while ( it.hasNext() ) + { + it.next(); + + if ( it.value()->uniqueName().isEmpty() ) + { + it.value()->setUniqueName( it.key()->uniqueName() ); + } + } + bool success = pdfConv->convert(); if (!success) {