From a4ead3e22605287206f054d77cee118e2d13a22a Mon Sep 17 00:00:00 2001 From: mat1jaczyyy Date: Sat, 26 Sep 2020 00:37:27 +0200 Subject: [PATCH] Heaven: Fix race condition when accessing Time while RenderThread is starting Fixes #395. --- Apollo/Rendering/Heaven.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Apollo/Rendering/Heaven.cs b/Apollo/Rendering/Heaven.cs index 17757bfb..63671981 100644 --- a/Apollo/Rendering/Heaven.cs +++ b/Apollo/Rendering/Heaven.cs @@ -42,6 +42,8 @@ public static double Time { static void Wake() { if (RenderThread?.IsCompleted == false) return; + prev = Program.TimeSpent.ElapsedTicks - 1; + RenderThread = Task.Run(() => { prev = Program.TimeSpent.ElapsedTicks - 1;