Browse Source

Revert "X11 backend wont crash with 0 sized window."

This reverts commit d49109877c.
pull/3453/head
Dan Walmsley 6 years ago
parent
commit
9fc7842eef
  1. 14
      src/Shared/PlatformSupport/StandardRuntimePlatform.cs

14
src/Shared/PlatformSupport/StandardRuntimePlatform.cs

@ -52,13 +52,11 @@ namespace Avalonia.Shared.PlatformSupport
public UnmanagedBlob(StandardRuntimePlatform plat, int size) public UnmanagedBlob(StandardRuntimePlatform plat, int size)
{ {
if (size > 0) if (size <= 0)
{ throw new ArgumentException("Positive number required", nameof(size));
_plat = plat; _plat = plat;
_address = plat.Alloc(size); _address = plat.Alloc(size);
GC.AddMemoryPressure(size); GC.AddMemoryPressure(size);
}
Size = size; Size = size;
#if DEBUG #if DEBUG
_backtrace = Environment.StackTrace; _backtrace = Environment.StackTrace;
@ -77,7 +75,7 @@ namespace Avalonia.Shared.PlatformSupport
lock (_btlock) lock (_btlock)
Backtraces.Remove(_backtrace); Backtraces.Remove(_backtrace);
#endif #endif
_plat?.Free(_address, Size); _plat.Free(_address, Size);
GC.RemoveMemoryPressure(Size); GC.RemoveMemoryPressure(Size);
IsDisposed = true; IsDisposed = true;
_address = IntPtr.Zero; _address = IntPtr.Zero;

Loading…
Cancel
Save