Skip to content

Commit

Permalink
Merge pull request gui-cs#3339 from tig/v2_3338-Toplevel-Must-Be-Disp…
Browse files Browse the repository at this point in the history
…osed

Fixes gui-cs#3338. `Application.Run/End` -> Callers must dispose Toplevel
  • Loading branch information
tig authored Mar 26, 2024
2 parents d5f3129 + fda20df commit 6070e80
Show file tree
Hide file tree
Showing 136 changed files with 3,191 additions and 2,182 deletions.
6 changes: 4 additions & 2 deletions Example/Example.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
using System;
using Terminal.Gui;

Application.Run<ExampleWindow> ();
var app = Application.Run<ExampleWindow> ();

Console.WriteLine ($"Username: {((ExampleWindow)Application.Top).UserNameText.Text}");
Console.WriteLine ($"Username: {app.UserNameText.Text}");

app.Dispose ();

// Before the application exits, reset Terminal.Gui for clean shutdown
Application.Shutdown ();
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Application.MainLoopSyncContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private sealed class MainLoopSyncContext : SynchronizationContext

public override void Post (SendOrPostCallback d, object state)
{
MainLoop.AddIdle (
MainLoop?.AddIdle (
() =>
{
d (state);
Expand Down
Loading

0 comments on commit 6070e80

Please sign in to comment.