File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 33// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
44
55using System ;
6+ using System . Collections . Concurrent ;
67using System . Collections . Generic ;
78using System . Linq ;
89using System . Reflection ;
@@ -44,7 +45,7 @@ public class JavascriptObjectRepository : IJavascriptObjectRepository
4445 /// this is done to speed up finding the object in O(1) time
4546 /// instead of traversing the JavaScriptRootObject tree.
4647 /// </summary>
47- private readonly Dictionary < long , JavascriptObject > objects = new Dictionary < long , JavascriptObject > ( ) ;
48+ private readonly ConcurrentDictionary < long , JavascriptObject > objects = new ConcurrentDictionary < long , JavascriptObject > ( ) ;
4849
4950 /// <summary>
5051 /// Has the browser this repository is associated with been initilized (set in OnAfterCreated)
@@ -195,7 +196,8 @@ public bool UnRegister(string name)
195196 {
196197 if ( string . Equals ( kvp . Value . Name , name , StringComparison . OrdinalIgnoreCase ) )
197198 {
198- objects . Remove ( kvp . Key ) ;
199+ JavascriptObject obj ;
200+ objects . TryRemove ( kvp . Key , out obj ) ;
199201
200202 return true ;
201203 }
You can’t perform that action at this time.
0 commit comments