|
|
@@ -79,12 +79,19 @@ internal class RenderDataDrawingContext : DrawingContext
|
|
|
|
|
|
if (!(parent.Node is T))
|
|
|
throw new InvalidOperationException("Invalid Pop operation");
|
|
|
-
|
|
|
- foreach(var item in _currentItemList!)
|
|
|
- parent.Node.Children.Add(item);
|
|
|
- _currentItemList.Clear();
|
|
|
- s_listPool.ReturnAndSetNull(ref _currentItemList);
|
|
|
+
|
|
|
+ var removeLastPush = true;
|
|
|
+ if (_currentItemList != null)
|
|
|
+ {
|
|
|
+ removeLastPush = _currentItemList.Count == 0;
|
|
|
+ foreach (var item in _currentItemList)
|
|
|
+ parent.Node.Children.Add(item);
|
|
|
+ _currentItemList.Clear();
|
|
|
+ s_listPool.ReturnAndSetNull(ref _currentItemList);
|
|
|
+ }
|
|
|
_currentItemList = parent.Items;
|
|
|
+ if (removeLastPush)
|
|
|
+ _currentItemList.RemoveAt(_currentItemList.Count - 1);
|
|
|
}
|
|
|
|
|
|
void AddResource(object? resource)
|