mirror of https://github.com/WerWolv/ImHex.git
sys: Clean up properly after file is closed
Addresses another issue in #362
This commit is contained in:
parent
73604e90c8
commit
8385b88ce8
|
@ -37,12 +37,17 @@ namespace hex {
|
|||
EventManager::subscribe<EventProjectFileStore>(this, []{
|
||||
ProjectFile::setBookmarks(SharedData::bookmarkEntries);
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventFileUnloaded>(this, []{
|
||||
ImHexApi::Bookmarks::getEntries().clear();
|
||||
});
|
||||
}
|
||||
|
||||
ViewBookmarks::~ViewBookmarks() {
|
||||
EventManager::unsubscribe<RequestAddBookmark>(this);
|
||||
EventManager::unsubscribe<EventProjectFileLoad>(this);
|
||||
EventManager::unsubscribe<EventProjectFileStore>(this);
|
||||
EventManager::unsubscribe<EventFileUnloaded>(this);
|
||||
}
|
||||
|
||||
void ViewBookmarks::drawContent() {
|
||||
|
|
|
@ -27,11 +27,16 @@ namespace hex {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventFileUnloaded>(this, [this]{
|
||||
this->m_disassembly.clear();
|
||||
});
|
||||
}
|
||||
|
||||
ViewDisassembler::~ViewDisassembler() {
|
||||
EventManager::unsubscribe<EventDataChanged>(this);
|
||||
EventManager::unsubscribe<EventRegionSelected>(this);
|
||||
EventManager::unsubscribe<EventFileUnloaded>(this);
|
||||
}
|
||||
|
||||
void ViewDisassembler::disassemble() {
|
||||
|
|
|
@ -39,11 +39,16 @@ namespace hex {
|
|||
if (this->m_blockSize != 0)
|
||||
this->m_entropyHandlePosition = region.address / this->m_blockSize;
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventFileUnloaded>(this, [this]{
|
||||
this->m_dataValid = false;
|
||||
});
|
||||
}
|
||||
|
||||
ViewInformation::~ViewInformation() {
|
||||
EventManager::unsubscribe<EventDataChanged>(this);
|
||||
EventManager::unsubscribe<EventRegionSelected>(this);
|
||||
EventManager::unsubscribe<EventFileUnloaded>(this);
|
||||
}
|
||||
|
||||
static float calculateEntropy(std::array<ImU64, 256> &valueCounts, size_t numBytes) {
|
||||
|
|
|
@ -152,6 +152,11 @@ namespace hex {
|
|||
}
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventFileUnloaded>(this, [this]{
|
||||
this->m_textEditor.SetText("");
|
||||
this->m_patternLanguageRuntime->abort();
|
||||
});
|
||||
|
||||
/* Settings */
|
||||
{
|
||||
|
||||
|
@ -181,6 +186,7 @@ namespace hex {
|
|||
EventManager::unsubscribe<RequestSetPatternLanguageCode>(this);
|
||||
EventManager::unsubscribe<EventFileLoaded>(this);
|
||||
EventManager::unsubscribe<RequestChangeTheme>(this);
|
||||
EventManager::unsubscribe<EventFileUnloaded>(this);
|
||||
}
|
||||
|
||||
void ViewPatternEditor::drawMenu() {
|
||||
|
|
|
@ -21,10 +21,15 @@ namespace hex {
|
|||
|
||||
this->m_filter.reserve(0xFFFF);
|
||||
std::memset(this->m_filter.data(), 0x00, this->m_filter.capacity());
|
||||
|
||||
EventManager::subscribe<EventFileUnloaded>(this, [this]{
|
||||
this->m_foundStrings.clear();
|
||||
});
|
||||
}
|
||||
|
||||
ViewStrings::~ViewStrings() {
|
||||
EventManager::unsubscribe<EventDataChanged>(this);
|
||||
EventManager::unsubscribe<EventFileUnloaded>(this);
|
||||
}
|
||||
|
||||
std::string readString(const FoundString &foundString) {
|
||||
|
|
Loading…
Reference in New Issue