Skip to content

Commit f9d25b0

Browse files
authored
Use correct lock object for predefined packages (#5018)
1 parent 55519af commit f9d25b0

File tree

1 file changed

+4
-3
lines changed
  • src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows

1 file changed

+4
-3
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,8 @@ public static StreamResourceInfo GetRemoteStream(Uri uriRemote)
700700
SiteOfOriginContainer sooContainer = (SiteOfOriginContainer)GetResourcePackage(packageUri);
701701

702702
// the SiteOfOriginContainer is shared across threads; synchronize access to it
703-
lock (_packageLock)
703+
// using the same lock object as other uses (PackWebResponse+CachedResponse.GetResponseStream)
704+
lock (sooContainer)
704705
{
705706
sooPart = sooContainer.GetPart(partUri) as SiteOfOriginPart;
706707
}
@@ -2017,8 +2018,9 @@ private static PackagePart GetResourceOrContentPart(Uri uri)
20172018
ResourceContainer resContainer = (ResourceContainer)GetResourcePackage(packageUri);
20182019

20192020
// the ResourceContainer is shared across threads; synchronize access to it
2021+
// using the same lock object as other uses (PackWebResponse+CachedResponse.GetResponseStream)
20202022
PackagePart part = null;
2021-
lock (_packageLock)
2023+
lock (resContainer)
20222024
{
20232025
part = resContainer.GetPart(partUri);
20242026
}
@@ -2417,7 +2419,6 @@ private object RunDispatcher(object ignore)
24172419
static private bool _appCreatedInThisAppDomain;
24182420
static private Application _appInstance;
24192421
static private Assembly _resourceAssembly;
2420-
static private object _packageLock = new Object();
24212422

24222423
// Keep LoadBamlSyncInfo stack so that the Outer LoadBaml and Inner LoadBaml( ) for the same
24232424
// Uri share the related information.

0 commit comments

Comments
 (0)