1
0
mirror of synced 2024-11-28 17:40:51 +01:00

fix: Crash when closing section with selected bytes

This commit is contained in:
WerWolv 2022-11-18 16:01:18 +01:00
parent 3d5190f51a
commit 7d0474335a
3 changed files with 5 additions and 1 deletions

View File

@ -21,6 +21,7 @@ namespace hex::plugin::builtin {
EventManager::subscribe<EventRegionSelected>(this, [this](const auto &region) {
if (!ImHexApi::Provider::isValid() || region == Region::Invalid()) {
this->m_validBytes = 0;
this->m_selectedProvider = nullptr;
} else {
this->m_validBytes = u64(region.getProvider()->getActualSize() - region.address);
this->m_startAddress = region.address;

View File

@ -864,6 +864,7 @@ namespace hex::plugin::builtin {
providerData.selectionStart.reset();
providerData.selectionEnd.reset();
EventManager::post<EventRegionSelected>(ImHexApi::HexEditor::ProviderRegion({ Region::Invalid(), nullptr }));
return;
}

View File

@ -524,8 +524,10 @@ namespace hex::plugin::builtin {
ImGui::End();
}
if (!open)
if (!open && this->m_sectionWindowDrawer.contains(provider)) {
ImHexApi::HexEditor::setSelection(Region::Invalid());
this->m_sectionWindowDrawer.erase(provider);
}
auto &extraData = ProviderExtraData::get(provider).patternLanguage;
if (!this->m_lastEvaluationProcessed) {