From 0c69e6ddfc9d00c735550c33e6b3402b78012ba3 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 27 Nov 2018 21:17:06 +0000 Subject: [PATCH] Changed how module properties are passed to lambda executed during hot-reloading as lambdas with mutable captures seems to be not always supported. --- Source/ImGui/Private/ImGuiModule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/ImGui/Private/ImGuiModule.cpp b/Source/ImGui/Private/ImGuiModule.cpp index d0bffec..802e744 100644 --- a/Source/ImGui/Private/ImGuiModule.cpp +++ b/Source/ImGui/Private/ImGuiModule.cpp @@ -133,7 +133,7 @@ void FImGuiModule::ShutdownModule() // In editor store data that we want to move to hot-reloaded module. #if WITH_EDITOR - TOptional PropertiesToMove = ImGuiModuleManager->GetProperties(); + static TOptional PropertiesToMove = ImGuiModuleManager->GetProperties(); #endif // Before we shutdown we need to delete managers that will do all the necessary cleanup. @@ -153,7 +153,7 @@ void FImGuiModule::ShutdownModule() // deleted. This can cause troubles after hot-reload when code in other modules calls ImGui interface functions // which are statically bound to the obsolete module. To keep ImGui code functional we can redirect context handle // to point to the new module. - FModuleManager::Get().OnModulesChanged().AddLambda([this, PropertiesToMove] (FName Name, EModuleChangeReason Reason) mutable + FModuleManager::Get().OnModulesChanged().AddLambda([this] (FName Name, EModuleChangeReason Reason) { if (Reason == EModuleChangeReason::ModuleLoaded && Name == "ImGui") {