From b6fda40128f87f2ffc6fc831b86ee27aead79cea Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Fri, 28 Jun 2024 17:13:23 +0200 Subject: [PATCH] Issue #190: PageMaster crash + black bubbles instead of bubbles with correct color --- Pdf4QtLibCore/sources/pdfdocumentbuilder.cpp | 13 +++++++++++++ Pdf4QtLibCore/sources/pdftransparencyrenderer.cpp | 3 +++ Pdf4QtPageMaster/pageitemdelegate.cpp | 3 +-- RELEASES.txt | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Pdf4QtLibCore/sources/pdfdocumentbuilder.cpp b/Pdf4QtLibCore/sources/pdfdocumentbuilder.cpp index be73df7..24de4ad 100644 --- a/Pdf4QtLibCore/sources/pdfdocumentbuilder.cpp +++ b/Pdf4QtLibCore/sources/pdfdocumentbuilder.cpp @@ -1284,6 +1284,19 @@ void PDFDocumentBuilder::mergeNames(PDFObjectReference a, PDFObjectReference b) const PDFDictionary* aDict = getDictionaryFromObject(aObject); const PDFDictionary* bDict = getDictionaryFromObject(bObject); + PDFDictionary aDictDummy; + PDFDictionary bDictDummy; + + if (!aDict) + { + aDict = &aDictDummy; + } + + if (!bDict) + { + bDict = &bDictDummy; + } + // Store keys std::set keys; for (size_t i = 0; i < aDict->getCount(); ++i) diff --git a/Pdf4QtLibCore/sources/pdftransparencyrenderer.cpp b/Pdf4QtLibCore/sources/pdftransparencyrenderer.cpp index 5a06ef3..2130e82 100644 --- a/Pdf4QtLibCore/sources/pdftransparencyrenderer.cpp +++ b/Pdf4QtLibCore/sources/pdftransparencyrenderer.cpp @@ -1245,6 +1245,9 @@ bool PDFTransparencyRenderer::isContentKindSuppressed(ContentKind kind) const } break; + case ContentKind::Forms: + return false; + default: Q_ASSERT(false); break; diff --git a/Pdf4QtPageMaster/pageitemdelegate.cpp b/Pdf4QtPageMaster/pageitemdelegate.cpp index c64ba33..d3ef5f3 100644 --- a/Pdf4QtPageMaster/pageitemdelegate.cpp +++ b/Pdf4QtPageMaster/pageitemdelegate.cpp @@ -107,8 +107,7 @@ void PageItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& opti continue; } - QColor color; - color.fromString(splitted.front()); + QColor color = QColor::fromString(splitted.front()); QRect bubbleRect = pdf::PDFPainterHelper::drawBubble(painter, tagPoint, color, splitted.back(), Qt::AlignLeft | Qt::AlignBottom); tagPoint.ry() += bubbleRect.height() + verticalSpacing; } diff --git a/RELEASES.txt b/RELEASES.txt index 5f5a288..301de92 100644 --- a/RELEASES.txt +++ b/RELEASES.txt @@ -1,4 +1,5 @@ CURRENT: + - Issue #190: PageMaster crash + black bubbles instead of bubbles with correct color - Issue #183: Option to ignore PDF security settings - Issue #182: PDF4QT Document Diff command line cmd line arguments ignored - Issue #181: where is the dark mode?