From 688c8ff4e4e6132c7a8caa9705649a5e842a899e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro?= Date: Sat, 16 Jan 2021 15:27:50 +0000 Subject: [PATCH 1/3] Fixed Avalonia version in About dialog. Hide "Development Build" text in release versions. --- src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml | 6 +++--- src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml.cs | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml b/src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml index e51cc2f3ce..c5e1d43d80 100644 --- a/src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml +++ b/src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml @@ -79,8 +79,8 @@ - - + + @@ -102,4 +102,4 @@ - \ No newline at end of file + diff --git a/src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml.cs b/src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml.cs index 09fab0ed3f..55e30396e1 100644 --- a/src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml.cs +++ b/src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml.cs @@ -1,3 +1,4 @@ +using System; using System.Diagnostics; using System.Runtime.InteropServices; using Avalonia.Controls; @@ -7,12 +8,18 @@ namespace Avalonia.Dialogs { public class AboutAvaloniaDialog : Window { + private static readonly Version s_version = typeof(AboutAvaloniaDialog).Assembly.GetName().Version; + + public static string Version { get; } = s_version.ToString(2); + + public static bool IsDevelopmentBuild { get; } = s_version.Revision == 999; + public AboutAvaloniaDialog() { AvaloniaXamlLoader.Load(this); DataContext = this; } - + public static void OpenBrowser(string url) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) From 4a160e31098af92de42fecdbb2da73f183f18d33 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 20 Jan 2021 22:22:48 +0300 Subject: [PATCH 2/3] Supporess finalization when UnmanagedBlob allocation failed --- .../StandardRuntimePlatform.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Shared/PlatformSupport/StandardRuntimePlatform.cs b/src/Shared/PlatformSupport/StandardRuntimePlatform.cs index d574732e3d..2e79762408 100644 --- a/src/Shared/PlatformSupport/StandardRuntimePlatform.cs +++ b/src/Shared/PlatformSupport/StandardRuntimePlatform.cs @@ -49,12 +49,20 @@ namespace Avalonia.Shared.PlatformSupport public UnmanagedBlob(StandardRuntimePlatform plat, int size) { - if (size <= 0) - throw new ArgumentException("Positive number required", nameof(size)); - _plat = plat; - _address = plat.Alloc(size); - GC.AddMemoryPressure(size); - Size = size; + try + { + if (size <= 0) + throw new ArgumentException("Positive number required", nameof(size)); + _plat = plat; + _address = plat.Alloc(size); + GC.AddMemoryPressure(size); + Size = size; + } + catch + { + GC.SuppressFinalize(); + throw; + } #if DEBUG _backtrace = Environment.StackTrace; lock (_btlock) From 8919949c9b37f084c80dfe8ede22e9ee2cc2908d Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Wed, 20 Jan 2021 22:35:58 +0300 Subject: [PATCH 3/3] this --- src/Shared/PlatformSupport/StandardRuntimePlatform.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shared/PlatformSupport/StandardRuntimePlatform.cs b/src/Shared/PlatformSupport/StandardRuntimePlatform.cs index 2e79762408..8521a50087 100644 --- a/src/Shared/PlatformSupport/StandardRuntimePlatform.cs +++ b/src/Shared/PlatformSupport/StandardRuntimePlatform.cs @@ -60,7 +60,7 @@ namespace Avalonia.Shared.PlatformSupport } catch { - GC.SuppressFinalize(); + GC.SuppressFinalize(this); throw; } #if DEBUG