diff --git a/lib/libimhex/include/hex/api/imhex_api.hpp b/lib/libimhex/include/hex/api/imhex_api.hpp index ac6e833e7..374c89e71 100644 --- a/lib/libimhex/include/hex/api/imhex_api.hpp +++ b/lib/libimhex/include/hex/api/imhex_api.hpp @@ -74,7 +74,7 @@ namespace hex { std::map &getTooltips(); std::map &getTooltipFunctions(); - void setCurrentSelection(std::optional region); + void setCurrentSelection(const std::optional ®ion); } /** diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index 8864cc2a8..afbd4e766 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -70,8 +70,8 @@ namespace hex { } static std::optional s_currentSelection; - void setCurrentSelection(std::optional region) { - s_currentSelection = std::move(region); + void setCurrentSelection(const std::optional ®ion) { + s_currentSelection = region; } } @@ -353,6 +353,7 @@ namespace hex { TaskManager::runWhenTasksFinished([provider] { EventManager::post(provider); + std::erase(impl::s_closingProviders, provider); delete provider; }); }