mirror of
https://github.com/ppy/osu.git
synced 2025-03-15 23:17:18 +08:00
Move previousContext
assign within lock
to make things look safer
Not an actual requirement, but no harm.
This commit is contained in:
parent
3291f15dcc
commit
f510ef9153
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Development;
|
using osu.Framework.Development;
|
||||||
@ -166,11 +167,15 @@ namespace osu.Game.Database
|
|||||||
private void flushContexts()
|
private void flushContexts()
|
||||||
{
|
{
|
||||||
Logger.Log(@"Flushing realm contexts...", LoggingTarget.Database);
|
Logger.Log(@"Flushing realm contexts...", LoggingTarget.Database);
|
||||||
|
Debug.Assert(blockingLock.CurrentCount == 0);
|
||||||
|
|
||||||
var previousContext = context;
|
Realm previousContext;
|
||||||
|
|
||||||
lock (updateContextLock)
|
lock (updateContextLock)
|
||||||
|
{
|
||||||
|
previousContext = context;
|
||||||
context = null;
|
context = null;
|
||||||
|
}
|
||||||
|
|
||||||
// wait for all threaded usages to finish
|
// wait for all threaded usages to finish
|
||||||
while (active_usages.Value > 0)
|
while (active_usages.Value > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user