diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-03-27 19:48:03 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-03-27 19:48:03 +0100 |
| commit | 4c6ffee1ea8206568de42b2d4e7b82883a984b7e (patch) | |
| tree | f8de576816ee1f3a3bb09eb6e19715015a696031 | |
| parent | 6360f5e939e4b30ed330478a4075dd7007a8a26e (diff) | |
test loadingThread != null before checking cancel state
| -rw-r--r-- | Crow/src/Widgets/TemplatedGroup.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Crow/src/Widgets/TemplatedGroup.cs b/Crow/src/Widgets/TemplatedGroup.cs index 7c84f545..cfa6cd1c 100644 --- a/Crow/src/Widgets/TemplatedGroup.cs +++ b/Crow/src/Widgets/TemplatedGroup.cs @@ -440,10 +440,14 @@ namespace Crow { if (iTemp == null) iTemp = ItemTemplates ["default"]; } - while (!Monitor.TryEnter(IFace.LayoutMutex)) { - if (loadingThread.cancelRequested) - return; - Thread.Sleep(1); + if (loadingThread == null) + Monitor.Enter(IFace.LayoutMutex); + else { + while (!Monitor.TryEnter(IFace.LayoutMutex)) { + if (loadingThread.cancelRequested) + return; + Thread.Sleep(1); + } } g = iTemp.CreateInstance(); |