From 78ef5b0d076ab175de9697cc9ab87d4a9346c893 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 14 Dec 2023 20:46:53 +0100 Subject: [PATCH] fix: ProviderChanged Event not being called correctly when closing first provider Fixes #1421, Fixes #1416 --- lib/libimhex/source/api/imhex_api.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index 5b8cbdb91..e90eb4a27 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -321,6 +321,9 @@ namespace hex { if (it == s_providers.begin()) { // If the first provider is being closed, select the one that's the first one now setCurrentProvider(0); + + if (s_providers.size() > 1) + EventProviderChanged::post(s_providers[0], s_providers[1]); } else if (std::distance(s_providers.begin(), it) == s_currentProvider) { // If the current provider is being closed, select the one that's before it