Changed how module properties are passed to lambda executed during hot-reloading as lambdas with mutable captures seems to be not always supported.

This commit is contained in:
Sebastian 2018-11-27 21:17:06 +00:00
parent c662869820
commit 0c69e6ddfc

View File

@ -133,7 +133,7 @@ void FImGuiModule::ShutdownModule()
// In editor store data that we want to move to hot-reloaded module. // In editor store data that we want to move to hot-reloaded module.
#if WITH_EDITOR #if WITH_EDITOR
TOptional<FImGuiModuleProperties> PropertiesToMove = ImGuiModuleManager->GetProperties(); static TOptional<FImGuiModuleProperties> PropertiesToMove = ImGuiModuleManager->GetProperties();
#endif #endif
// Before we shutdown we need to delete managers that will do all the necessary cleanup. // 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 // 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 // which are statically bound to the obsolete module. To keep ImGui code functional we can redirect context handle
// to point to the new module. // 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") if (Reason == EModuleChangeReason::ModuleLoaded && Name == "ImGui")
{ {