Browse Source

guard against double dispose.

pull/1977/head
Dan Walmsley 8 years ago
parent
commit
bc062dc350
  1. 14
      src/Avalonia.Native/WindowImplBase.cs

14
src/Avalonia.Native/WindowImplBase.cs

@ -1,4 +1,4 @@
// Copyright (c) The Avalonia Project. All rights reserved. // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information. // Licensed under the MIT license. See licence.md file in the project root for full license information.
using System; using System;
@ -254,11 +254,15 @@ namespace Avalonia.Native
public virtual void Dispose() public virtual void Dispose()
{ {
_native?.Close(); if (!_isClosed)
_native?.Dispose(); {
_native = null; _isClosed = true;
_native?.Close();
_native?.Dispose();
_native = null;
(Screen as ScreenImpl)?.Dispose(); (Screen as ScreenImpl)?.Dispose();
}
} }

Loading…
Cancel
Save