1
0
mirror of synced 2024-11-12 02:00:52 +01:00

fix: Crashes when having pattern auto evaluation enabled

This commit is contained in:
WerWolv 2023-08-16 22:26:05 +02:00
parent 33e9ad7775
commit 8a2afd1c05
2 changed files with 6 additions and 1 deletions

View File

@ -133,6 +133,7 @@ namespace hex::plugin::builtin {
PerProvider<std::vector<std::fs::path>> m_possiblePatternFiles; PerProvider<std::vector<std::fs::path>> m_possiblePatternFiles;
bool m_runAutomatically = false; bool m_runAutomatically = false;
bool m_triggerEvaluation = false; bool m_triggerEvaluation = false;
std::atomic<bool> m_triggerAutoEvaluate = false;
bool m_lastEvaluationProcessed = true; bool m_lastEvaluationProcessed = true;
bool m_lastEvaluationResult = false; bool m_lastEvaluationResult = false;

View File

@ -281,9 +281,13 @@ namespace hex::plugin::builtin {
this->parsePattern(code, provider); this->parsePattern(code, provider);
if (this->m_runAutomatically) if (this->m_runAutomatically)
this->evaluatePattern(code, provider); this->m_triggerAutoEvaluate = true;
}); });
} }
if (this->m_triggerAutoEvaluate.exchange(false)) {
this->evaluatePattern(this->m_textEditor.GetText(), provider);
}
} }
if (this->m_dangerousFunctionCalled && !ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopup)) { if (this->m_dangerousFunctionCalled && !ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopup)) {