Browse Source

Merge branch 'master' into adirh3/mica-backdrop-brush

pull/6574/head
Tako 5 years ago
committed by GitHub
parent
commit
d1dea56851
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/Avalonia.Controls/Repeater/ItemsRepeater.cs
  2. 7
      src/Avalonia.X11/X11Platform.cs
  3. 24
      tests/Avalonia.Controls.UnitTests/ItemsRepeaterTests.cs

6
src/Avalonia.Controls/Repeater/ItemsRepeater.cs

@ -588,14 +588,14 @@ namespace Avalonia.Controls
throw new AvaloniaInternalException("Cannot set ItemsSourceView during layout."); throw new AvaloniaInternalException("Cannot set ItemsSourceView during layout.");
} }
ItemsSourceView?.Dispose();
ItemsSourceView = newValue;
if (oldValue != null) if (oldValue != null)
{ {
oldValue.CollectionChanged -= OnItemsSourceViewChanged; oldValue.CollectionChanged -= OnItemsSourceViewChanged;
} }
ItemsSourceView?.Dispose();
ItemsSourceView = newValue;
if (newValue != null) if (newValue != null)
{ {
newValue.CollectionChanged += OnItemsSourceViewChanged; newValue.CollectionChanged += OnItemsSourceViewChanged;

7
src/Avalonia.X11/X11Platform.cs

@ -52,11 +52,14 @@ namespace Avalonia.X11
XInitThreads(); XInitThreads();
Display = XOpenDisplay(IntPtr.Zero); Display = XOpenDisplay(IntPtr.Zero);
if (Display == IntPtr.Zero)
throw new Exception("XOpenDisplay failed");
DeferredDisplay = XOpenDisplay(IntPtr.Zero); DeferredDisplay = XOpenDisplay(IntPtr.Zero);
if (DeferredDisplay == IntPtr.Zero)
throw new Exception("XOpenDisplay failed");
OrphanedWindow = XCreateSimpleWindow(Display, XDefaultRootWindow(Display), 0, 0, 1, 1, 0, IntPtr.Zero, OrphanedWindow = XCreateSimpleWindow(Display, XDefaultRootWindow(Display), 0, 0, 1, 1, 0, IntPtr.Zero,
IntPtr.Zero); IntPtr.Zero);
if (Display == IntPtr.Zero)
throw new Exception("XOpenDisplay failed");
XError.Init(); XError.Init();
Info = new X11Info(Display, DeferredDisplay, useXim); Info = new X11Info(Display, DeferredDisplay, useXim);

24
tests/Avalonia.Controls.UnitTests/ItemsRepeaterTests.cs

@ -0,0 +1,24 @@
using System.Collections.ObjectModel;
using Xunit;
namespace Avalonia.Controls.UnitTests
{
public class ItemsRepeaterTests
{
[Fact]
public void Can_Reassign_Items()
{
var target = new ItemsRepeater();
target.Items = new ObservableCollection<string>();
target.Items = new ObservableCollection<string>();
}
[Fact]
public void Can_Reassign_Items_To_Null()
{
var target = new ItemsRepeater();
target.Items = new ObservableCollection<string>();
target.Items = null;
}
}
}
Loading…
Cancel
Save