From a17b647e79eb58a409bc04a4596d80fbe8c79028 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 17 Mar 2022 23:29:52 +0100 Subject: [PATCH] patterns: Fixed static arrays showing same value for all entries --- .../include/hex/pattern_language/patterns/pattern.hpp | 4 ++++ .../hex/pattern_language/patterns/pattern_array_static.hpp | 1 + 2 files changed, 5 insertions(+) diff --git a/lib/libimhex/include/hex/pattern_language/patterns/pattern.hpp b/lib/libimhex/include/hex/pattern_language/patterns/pattern.hpp index 944c4c18c..e70d21295 100644 --- a/lib/libimhex/include/hex/pattern_language/patterns/pattern.hpp +++ b/lib/libimhex/include/hex/pattern_language/patterns/pattern.hpp @@ -240,6 +240,10 @@ namespace hex::pl { return this->m_cachedDisplayValue.value(); } + void clearFormatCache() { + this->m_cachedDisplayValue.reset(); + } + protected: void createDefaultEntry(const std::string &value, Token::Literal &&literal) const { ImGui::TableNextRow(); diff --git a/lib/libimhex/include/hex/pattern_language/patterns/pattern_array_static.hpp b/lib/libimhex/include/hex/pattern_language/patterns/pattern_array_static.hpp index 29bcc8145..de3270221 100644 --- a/lib/libimhex/include/hex/pattern_language/patterns/pattern_array_static.hpp +++ b/lib/libimhex/include/hex/pattern_language/patterns/pattern_array_static.hpp @@ -55,6 +55,7 @@ namespace hex::pl { if (open) { auto entry = this->m_template->clone(); for (u64 index = 0; index < this->m_entryCount; index++) { + entry->clearFormatCache(); entry->setVariableName(hex::format("[{0}]", index)); entry->setOffset(this->getOffset() + index * this->m_template->getSize()); entry->draw(provider);