1
Fork 0

Create cell storage in a task, fixes CTD when accessing a created container from another thread

ae-1.6.629
Eddoursul 3 months ago
parent 4a1218782f
commit 7918a84386
  1. BIN
      Artifact Tracker.esp
  2. BIN
      SKSE/Plugins/ArtifactTracker.dll
  3. 25
      Source/ArtifactTrackerDLL/src/ArtifactTracker.cpp

Binary file not shown.

Binary file not shown.

@ -375,21 +375,20 @@ namespace ArtifactTracker
log::info("Adding new storage in {}", cell->GetName());
#endif
cellStorage = RE::PlayerCharacter::GetSingleton()->PlaceObjectAtMe(g_cellContainer, true).get();
SKSE::GetTaskInterface()->AddTask([&]() {
cellStorage = RE::PlayerCharacter::GetSingleton()->PlaceObjectAtMe(g_cellContainer, true).get();
if (cellStorage) {
cellStorage->Disable();
g_persistentStorage->AddForm(cellStorage);
g_persistentMap[cellStorage->formID] = cellStorage;
ToggleHomeMode(cellStorage);
std::thread([]() {
std::this_thread::sleep_for(std::chrono::milliseconds(500));
if (cellStorage) {
cellStorage->Disable();
g_persistentStorage->AddForm(cellStorage);
g_persistentMap[cellStorage->formID] = cellStorage;
ToggleHomeMode(cellStorage);
SyncCellStorage();
}).detach();
} else {
log::error("Failed to create cell storage in OnCellEnter");
ToggleHomeMode(nullptr);
}
} else {
log::error("Failed to create cell storage in OnCellEnter");
ToggleHomeMode(nullptr);
}
});
}
void SyncCellStorage(const RE::TESObjectREFR* a_ignoreRef)

Loading…
Cancel
Save