1
0
mirror of synced 2025-01-30 19:43:43 +01:00

fix: Crash when deleting overlays

This commit is contained in:
WerWolv 2023-06-03 22:50:37 +02:00
parent aca949175d
commit 1dff81f7cd

View File

@ -21,8 +21,9 @@ namespace hex::prv {
} }
Provider::~Provider() { Provider::~Provider() {
for (auto &overlay : this->m_overlays) for (auto overlay : this->m_overlays)
this->deleteOverlay(overlay); delete overlay;
this->m_overlays.clear();
} }
void Provider::read(u64 offset, void *buffer, size_t size, bool overlays) { void Provider::read(u64 offset, void *buffer, size_t size, bool overlays) {
@ -147,7 +148,7 @@ namespace hex::prv {
} }
void Provider::deleteOverlay(Overlay *overlay) { void Provider::deleteOverlay(Overlay *overlay) {
this->m_overlays.erase(std::find(this->m_overlays.begin(), this->m_overlays.end(), overlay)); this->m_overlays.remove(overlay);
delete overlay; delete overlay;
} }