From f87806e5a94bcb86a23022591c643873fbad15ce Mon Sep 17 00:00:00 2001 From: ZXGuesser Date: Fri, 29 Sep 2017 02:35:50 +0100 Subject: [PATCH] remove pages from _specialPages list when they are marked for deletion --- packetmag.cpp | 8 +++++++- specialpages.cpp | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packetmag.cpp b/packetmag.cpp index 7be8a77..5e2ded1 100644 --- a/packetmag.cpp +++ b/packetmag.cpp @@ -99,6 +99,12 @@ Packet* PacketMag::GetPacket(Packet* p) { _page=_specialPages->NextPage(); + if (_page && _page->GetStatusFlag()==TTXPageStream::MARKED) + { + _specialPages->deletePage(_page); + return nullptr; + } + if (_page) { // got a special page @@ -108,7 +114,7 @@ Packet* PacketMag::GetPacket(Packet* p) // Magazine Inventory Page ClearEvent(EVENT_FIELD); // enforce 20ms page erasure interval } - + /* rules for the control bits are complicated. There are rules to allow the page to be sent as fragments. Since we aren't doing that, all the flags are left clear except for C9 (interrupted sequence) to keep special pages out of rolling headers */ thisStatus = _page->GetPageStatus() & 0x8000; // get transmit flag thisStatus |= 0x0010; diff --git a/specialpages.cpp b/specialpages.cpp index 8d20e50..7b131ac 100644 --- a/specialpages.cpp +++ b/specialpages.cpp @@ -21,6 +21,8 @@ void SpecialPages::addPage(TTXPageStream* p) void SpecialPages::deletePage(TTXPageStream* p) { _specialPagesList.remove(p); + _page = nullptr; + _iter--; // roll back iterator in case this was the last in list } TTXPageStream* SpecialPages::NextPage()