Skip to content

Commit 356e45d

Browse files
CopilotPureWeen
andcommitted
Change order of operations in Window.Destroying to dispose scope after disconnecting handler
Co-authored-by: PureWeen <[email protected]>
1 parent c0f7dc0 commit 356e45d

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
@@ -553,11 +553,11 @@ void IWindow.Destroying()
553553
AlertManager.Unsubscribe();
554554
Application?.RemoveWindow(this);
555555

556-
// Dispose the window-scoped service scope
557-
if (Handler?.MauiContext is MauiContext mauiContext)
558-
mauiContext.DisposeWindowScope();
559-
556+
var mauiContext = Handler?.MauiContext as MauiContext;
560557
Handler?.DisconnectHandler();
558+
559+
// Dispose the window-scoped service scope
560+
mauiContext?.DisposeWindowScope();
561561
}
562562

563563
void IWindow.Resumed()

0 commit comments

Comments
 (0)