From 955a1262e97d387c9777cce652252cacce44ab42 Mon Sep 17 00:00:00 2001 From: "G.K.MacGregor" Date: Tue, 9 May 2023 23:35:29 +0100 Subject: [PATCH] Clear invocation QMaps on empty triplet list Fixes a bug where local enhancements hung around when switching to a subpage without enhancements. --- decode.cpp | 19 +++++++++++++------ decode.h | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/decode.cpp b/decode.cpp index 8258e13..c665c72 100644 --- a/decode.cpp +++ b/decode.cpp @@ -32,6 +32,15 @@ TeletextPageDecode::Invocation::Invocation() m_fullScreenCLUT = -1; } +void TeletextPageDecode::Invocation::clear() +{ + m_characterMap.clear(); + m_attributeMap.clear(); + m_rightMostColumn.clear(); + m_fullScreenCLUT = -1; + m_fullRowCLUTMap.clear(); +} + void TeletextPageDecode::Invocation::setTripletList(X26TripletList *tripletList) { m_tripletList = tripletList; @@ -62,11 +71,7 @@ void TeletextPageDecode::Invocation::buildMap(int level) else endTripletNumber = m_endTripletNumber; - m_characterMap.clear(); - m_attributeMap.clear(); - m_rightMostColumn.clear(); - m_fullScreenCLUT = -1; - m_fullRowCLUTMap.clear(); + clear(); for (int i=m_startTripletNumber; i<=endTripletNumber; i++) { const X26Triplet triplet = m_tripletList->at(i); @@ -221,8 +226,10 @@ void TeletextPageDecode::updateSidePanels() void TeletextPageDecode::buildInvocationList(Invocation &invocation, int objectType) { - if (invocation.tripletList()->isEmpty()) + if (invocation.tripletList()->isEmpty()) { + invocation.clear(); return; + } int i; diff --git a/decode.h b/decode.h index c428367..1870e0f 100644 --- a/decode.h +++ b/decode.h @@ -184,6 +184,7 @@ private: Invocation(); X26TripletList *tripletList() const { return m_tripletList; }; + void clear(); void setTripletList(X26TripletList *); int startTripletNumber() const { return m_startTripletNumber; }; void setStartTripletNumber(int);