Skip to content

Commit 146f4ba

Browse files
CopilotPureWeen
andcommitted
Change order of operations in Window.Destroying to dispose scope after disconnecting handler
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
1 parent e2a04ac commit 146f4ba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Controls/src/Core/Window/Window.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,11 @@ void IWindow.Destroying()
546546
AlertManager.Unsubscribe();
547547
Application?.RemoveWindow(this);
548548

549-
// Dispose the window-scoped service scope
550-
if (Handler?.MauiContext is MauiContext mauiContext)
551-
mauiContext.DisposeWindowScope();
552-
549+
var mauiContext = Handler?.MauiContext as MauiContext;
553550
Handler?.DisconnectHandler();
551+
552+
// Dispose the window-scoped service scope
553+
mauiContext?.DisposeWindowScope();
554554
}
555555

556556
void IWindow.Resumed()

0 commit comments

Comments
 (0)