mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-30 09:47:58 +01:00
with #520 fixed, cleaning up comments and tests
This commit is contained in:
@@ -1046,14 +1046,13 @@ namespace Terminal.Gui {
|
||||
// Shutdown is the bookend for Init. As such it needs to clean up all resources
|
||||
// Init created. Apps that do any threading will need to code defensively for this.
|
||||
// e.g. see Issue #537
|
||||
// TODO: Some of this state is actually related to Begin/End (not Init/Shutdown) and should be moved to `RunState` (#520)
|
||||
foreach (var t in toplevels) {
|
||||
t.Running = false;
|
||||
t.Dispose ();
|
||||
}
|
||||
toplevels.Clear ();
|
||||
Current = null;
|
||||
// Fix #520: Dispose Top
|
||||
// Fixes #520: Dispose Top
|
||||
Top?.Dispose ();
|
||||
Top = null;
|
||||
|
||||
|
||||
@@ -19,13 +19,6 @@ namespace UICatalog.Scenarios {
|
||||
|
||||
public override void Run ()
|
||||
{
|
||||
// BUGBUG: work around Issue #520: Ensuring the `Toplevel` created by `Init` gets Disposed...
|
||||
// For Scenarios that want to use `Applciation.Run<T>` to create a new Toplevel:
|
||||
// Override `Run` and call `Application.Top.Dispose` before calling `Application.Run<T>`.
|
||||
//if (Application.Top != null) {
|
||||
// Application.Top.Dispose ();
|
||||
//}
|
||||
|
||||
Application.Run<MdiMain> ();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace UICatalog.Scenarios {
|
||||
public override void Init (ColorScheme colorScheme)
|
||||
{
|
||||
Application.Init ();
|
||||
Top = Application.Top;
|
||||
|
||||
var menu = new MenuBar (new MenuBarItem [] {
|
||||
new MenuBarItem ("_File", new MenuItem [] {
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Terminal.Gui.Core {
|
||||
|
||||
// BUGBUG: Because of #520, the Toplevel created by Application.Init is not disposed by Shutdown
|
||||
// So we need to dispose it manually
|
||||
Application.Top.Dispose ();
|
||||
//Application.Top.Dispose ();
|
||||
|
||||
Application.Shutdown ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user