Assert ViewStreamDatabase.instance is only created once

The instance must be initialized via ViewStreamDatabase.SetGlobalInstance
This commit is contained in:
John Colvin committed 2025-11-03 16:13:44 -05:00
1 parent 7c61c2ef6d
commit 8637bb9254
2 files changed
+8 -18

No files matched your search

@@ -35,20 +35,10 @@ namespace BCG {
public static ViewStreamDatabase instance {
get {
if (mySelf == null || mySelf.myIsDisposed)
lock (myInstanceLockObject) {
if (mySelf == null || mySelf.myIsDisposed) {
mySelf = new ViewStreamDatabase();
}
}
return mySelf;
}
set {
lock (myInstanceLockObject) {
if (mySelf != null)
mySelf.mySubscriberCore.Dispose();
mySelf = value;
}
var rv = mySelf;
Log.notnull(rv);
Log.assert(!rv.myIsDisposed);
return rv;
}
}
@@ -187,8 +177,10 @@ namespace BCG {
}
internal static void SetGlobalInstance(ViewStreamDatabase vsd) {
Log.isnull(mySelf);
mySelf = vsd;
lock (myInstanceLockObject) {
Log.isnull(mySelf);
mySelf = vsd;
}
}
private List<PendingAddRemoveWorker> _pending_worker_ops = new List<PendingAddRemoveWorker>();