File tree 4 files changed +8
-7
lines changed
src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows
4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -700,7 +700,8 @@ public static StreamResourceInfo GetRemoteStream(Uri uriRemote)
700
700
SiteOfOriginContainer sooContainer = ( SiteOfOriginContainer ) GetResourcePackage ( packageUri ) ;
701
701
702
702
// 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 )
704
705
{
705
706
sooPart = sooContainer . GetPart ( partUri ) as SiteOfOriginPart ;
706
707
}
@@ -2017,8 +2018,9 @@ private static PackagePart GetResourceOrContentPart(Uri uri)
2017
2018
ResourceContainer resContainer = ( ResourceContainer ) GetResourcePackage ( packageUri ) ;
2018
2019
2019
2020
// the ResourceContainer is shared across threads; synchronize access to it
2021
+ // using the same lock object as other uses (PackWebResponse+CachedResponse.GetResponseStream)
2020
2022
PackagePart part = null ;
2021
- lock ( _packageLock )
2023
+ lock ( resContainer )
2022
2024
{
2023
2025
part = resContainer . GetPart ( partUri ) ;
2024
2026
}
@@ -2417,7 +2419,6 @@ private object RunDispatcher(object ignore)
2417
2419
static private bool _appCreatedInThisAppDomain ;
2418
2420
static private Application _appInstance ;
2419
2421
static private Assembly _resourceAssembly ;
2420
- static private object _packageLock = new Object ( ) ;
2421
2422
2422
2423
// Keep LoadBamlSyncInfo stack so that the Outer LoadBaml and Inner LoadBaml( ) for the same
2423
2424
// Uri share the related information.
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ protected override List<AutomationPeer> GetChildrenCore()
131
131
132
132
// protection from indistinguishable items - for example, 2 strings with same value
133
133
// this scenario does not work in ItemsControl however is not checked for.
134
- if ( ItemPeers [ dataItem ] == null )
134
+ if ( peer != null && ItemPeers [ dataItem ] == null )
135
135
{
136
136
children . Add ( peer ) ;
137
137
ItemPeers [ dataItem ] = peer ;
Original file line number Diff line number Diff line change @@ -274,8 +274,8 @@ protected override List<AutomationPeer> GetChildrenCore()
274
274
// but only if we haven't added a peer for this item during this GetChildrenCore call.
275
275
bool itemMissingPeerInGlobalStorage = itemsControlAP . ItemPeers [ item ] == null ;
276
276
277
- if ( itemMissingPeerInGlobalStorage
278
- || ( peer ? . GetParent ( ) == this && addedChildren [ item ] == null ) )
277
+ if ( peer != null && ( itemMissingPeerInGlobalStorage
278
+ || ( peer . GetParent ( ) == this && addedChildren [ item ] == null ) ) )
279
279
{
280
280
children . Add ( peer ) ;
281
281
addedChildren [ item ] = peer ;
Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ protected override List<AutomationPeer> GetChildrenCore()
199
199
200
200
// protection from indistinguishable items - for example, 2 strings with same value
201
201
// this scenario does not work in ItemsControl however is not checked for.
202
- if ( _dataChildren [ dataItem ] == null )
202
+ if ( peer != null && _dataChildren [ dataItem ] == null )
203
203
{
204
204
children . Add ( peer ) ;
205
205
_dataChildren [ dataItem ] = peer ;
You can’t perform that action at this time.
0 commit comments