From 85de29562994a5f2347bb0d04e604bbbbb435c0e Mon Sep 17 00:00:00 2001 From: Jumar Macato <16554748+jmacato@users.noreply.github.com> Date: Fri, 12 Nov 2021 17:24:44 +0800 Subject: [PATCH] formatting --- src/Avalonia.X11/X11PlatformLifetimeEvents.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.X11/X11PlatformLifetimeEvents.cs b/src/Avalonia.X11/X11PlatformLifetimeEvents.cs index a8beb8bbd6..4762834b11 100644 --- a/src/Avalonia.X11/X11PlatformLifetimeEvents.cs +++ b/src/Avalonia.X11/X11PlatformLifetimeEvents.cs @@ -17,7 +17,8 @@ namespace Avalonia.X11 private const ulong SmcSaveCompleteProcMask = 4L; private const ulong SmcShutdownCancelledProcMask = 8L; - private static readonly ConcurrentDictionary s_nativeToManagedMapper = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary s_nativeToManagedMapper = + new ConcurrentDictionary(); private static readonly SMLib.SmcSaveYourselfProc s_saveYourselfProcDelegate = SmcSaveYourselfHandler; private static readonly SMLib.SmcDieProc s_dieDelegate = SmcDieHandler; @@ -196,7 +197,10 @@ namespace Avalonia.X11 private void SaveYourselfHandler(IntPtr smcConn, IntPtr clientData, bool shutdown, bool fast) { if (_saveYourselfPhase) + { SMLib.SmcSaveYourselfDone(smcConn, true); + } + _saveYourselfPhase = true; if (shutdown && !fast) @@ -216,10 +220,12 @@ namespace Avalonia.X11 { // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (ShutdownRequested is null) + { return; - - var e = new ShutdownRequestedEventArgs(); + } + var e = new ShutdownRequestedEventArgs(); + ShutdownRequested(this, e); var shutdownCancelled = e.Cancel; @@ -227,16 +233,19 @@ namespace Avalonia.X11 SMLib.SmcInteractDone(smcConn, shutdownCancelled); if (shutdownCancelled) + { return; - - _saveYourselfPhase = false; + } + _saveYourselfPhase = false; + SMLib.SmcSaveYourselfDone(smcConn, true); } private static void IceWatchHandler(IntPtr iceConn, IntPtr clientData, bool opening, IntPtr* watchData) { if (!opening) return; + ICELib.IceRemoveConnectionWatch(Marshal.GetFunctionPointerForDelegate(s_iceWatchProcDelegate), IntPtr.Zero); }