Skip to content

Commit

Permalink
Fix segfault in packaging process
Browse files Browse the repository at this point in the history
  • Loading branch information
nxrighthere committed Jan 25, 2022
1 parent 93928fc commit 1f29fa2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Binary file modified Content/Tests/Tests.umap
Binary file not shown.
11 changes: 4 additions & 7 deletions Source/Native/Source/UnrealCLR/Private/UnrealCLR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,8 +1352,6 @@ void UnrealCLR::Module::StartupModule() {
return;
}

UnrealCLR::Engine::Manager = NewObject<UUnrealCLRManager>();
UnrealCLR::Engine::Manager->AddToRoot();
UnrealCLR::Status = UnrealCLR::StatusType::Idle;

UE_LOG(LogUnrealCLR, Display, TEXT("%s: Host loaded succesfuly!"), ANSI_TO_TCHAR(__FUNCTION__));
Expand All @@ -1368,11 +1366,6 @@ void UnrealCLR::Module::StartupModule() {
}

void UnrealCLR::Module::ShutdownModule() {
if (UnrealCLR::Engine::Manager) {
UnrealCLR::Engine::Manager->RemoveFromRoot();
UnrealCLR::Engine::Manager = nullptr;
}

FWorldDelegates::OnPostWorldInitialization.Remove(OnWorldPostInitializationHandle);
FWorldDelegates::OnWorldCleanup.Remove(OnWorldCleanupHandle);

Expand All @@ -1382,6 +1375,8 @@ void UnrealCLR::Module::ShutdownModule() {
void UnrealCLR::Module::OnWorldPostInitialization(UWorld* World, const UWorld::InitializationValues InitializationValues) {
if (World->IsGameWorld()) {
if (UnrealCLR::WorldTickState == TickState::Stopped) {
UnrealCLR::Engine::Manager = NewObject<UUnrealCLRManager>();
UnrealCLR::Engine::Manager->AddToRoot();
UnrealCLR::Engine::World = World;

if (UnrealCLR::Status != UnrealCLR::StatusType::Stopped) {
Expand Down Expand Up @@ -1430,6 +1425,8 @@ void UnrealCLR::Module::OnWorldCleanup(UWorld* World, bool SessionEnded, bool Cl
}

UnrealCLR::Engine::World = nullptr;
UnrealCLR::Engine::Manager->RemoveFromRoot();
UnrealCLR::Engine::Manager = nullptr;
UnrealCLR::WorldTickState = UnrealCLR::TickState::Stopped;

FMemory::Memset(UnrealCLR::Shared::Events, 0, sizeof(UnrealCLR::Shared::Events));
Expand Down
2 changes: 1 addition & 1 deletion Source/Native/UnrealCLR.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.31",
"VersionName": "1.32",
"FriendlyName": "UnrealCLR",
"Description": ".NET 6 integration",
"Category": "Scripting",
Expand Down

0 comments on commit 1f29fa2

Please sign in to comment.