static void ProxyStop(IntPtr h) { isExiting = true; if (CancelActiveActionsOnStop) { Current.ActionManager.CancelActiveActions(); } LogSharp.Debug("ProxyStop"); UrhoPlatformInitializer.Initialized = false; var context = Current.Context; var app = GetApp(h); app.IsClosed = true; app.Stop(); #if ANDROID LogSharp.Debug("ProxyStop: Runtime.Cleanup"); Runtime.Cleanup(false); LogSharp.Debug("ProxyStop: Disposing context"); Current = null; #else LogSharp.Debug("ProxyStop: Runtime.Cleanup"); Runtime.Cleanup(); LogSharp.Debug("ProxyStop: Disposing context"); Current = null; #endif Stopped?.Invoke(); LogSharp.Debug("ProxyStop: end"); exitTask?.TrySetResult(true); }
static void ProxyStop(IntPtr h) { LogSharp.Debug("ProxyStop"); UrhoPlatformInitializer.Initialized = false; var context = Current.Context; var app = GetApp(h); app.IsClosed = true; app.UnsubscribeFromAppEvents(); app.Stop(); LogSharp.Debug("ProxyStop: Runtime.Cleanup"); Runtime.Cleanup(); LogSharp.Debug("ProxyStop: Releasing context"); #if ANDROID if (context.Refs() > 0) { context.ReleaseRef(); } #endif LogSharp.Debug("ProxyStop: Disposing context"); context.Dispose(); Current = null; Stoped?.Invoke(); LogSharp.Debug("ProxyStop: end"); exitTask?.TrySetResult(true); }
internal static async Task StopCurrent() { if (current == null || !current.IsActive) { return; } Current.Input.Enabled = false; isExiting = true; #if IOS iOS.UrhoSurface.StopRendering(current); #endif #if WINDOWS_UWP && !UWP_HOLO UWP.UrhoSurface.StopRendering().Wait(); #endif LogSharp.Debug($"StopCurrent: Current.IsFrameRendering={Current.IsFrameRendering}"); if (Current.IsFrameRendering) // && !Current.Engine.PauseMinimized) { waitFrameEndTaskSource = new TaskCompletionSource <bool>(); await waitFrameEndTaskSource.Task; LogSharp.Debug($"StopCurrent: waitFrameEndTaskSource awaited"); waitFrameEndTaskSource = null; } LogSharp.Debug($"StopCurrent: Engine.Exit"); #if ANDROID if (System.Threading.Thread.CurrentThread.ManagedThreadId != renderThreadId) { exitTask = new TaskCompletionSource <bool>(); InvokeOnMainAsync(() => Current.Engine.Exit()).Wait(); //Current.UrhoSurface?.Remove(); //Current.UrhoSurface = null; await exitTask.Task; //.Wait(); } #else Current.Engine.Exit(); #endif #if !ANDROID #if DESKTOP if (Current.Options.DelayedStart) #endif ProxyStop(Current.Handle); #endif GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); }
internal static async Task StopCurrent() { if (current == null || !current.IsActive) { return; } #if ANDROID current.WaitFrameEnd(); Org.Libsdl.App.SDLActivity.OnDestroy(); return; #endif Current.Input.Enabled = false; isExiting = true; #if IOS iOS.UrhoSurface.StopRendering(current); #endif #if WINDOWS_UWP && !UWP_HOLO UWP.UrhoSurface.StopRendering().Wait(); #endif LogSharp.Debug($"StopCurrent: Current.IsFrameRendering={Current.IsFrameRendering}"); if (Current.IsFrameRendering) // && !Current.Engine.PauseMinimized) { waitFrameEndTaskSource = new TaskCompletionSource <bool>(); await waitFrameEndTaskSource.Task; LogSharp.Debug($"StopCurrent: waitFrameEndTaskSource awaited"); waitFrameEndTaskSource = null; } LogSharp.Debug($"StopCurrent: Engine.Exit"); Current.Engine.Exit(); #if DESKTOP if (Current.Options.DelayedStart) #endif ProxyStop(Current.Handle); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); }
static async void ProxyStop(IntPtr h) { Current.ActionManager.CancelActiveActions(); LogSharp.Debug("ProxyStop"); UrhoPlatformInitializer.Initialized = false; var context = Current.Context; var app = GetApp(h); app.IsClosed = true; app.UnsubscribeFromAppEvents(); app.Stop(); LogSharp.Debug("ProxyStop: Runtime.Cleanup"); Runtime.Cleanup(); LogSharp.Debug("ProxyStop: Disposing context"); context.Dispose(); Current = null; Stoped?.Invoke(); LogSharp.Debug("ProxyStop: end"); exitTask?.TrySetResult(true); }