From f7fe5380b443925f7b80cf1fb138fa6758f3dd0c Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Fri, 10 May 2019 17:51:21 +0100 Subject: [PATCH] Use Take(1) to unsubscribe the event. --- .../Notifications/WindowNotificationManager.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs b/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs index 93cb3b96b5..b1ae81abc9 100644 --- a/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs +++ b/src/Avalonia.Controls/Notifications/WindowNotificationManager.cs @@ -59,13 +59,9 @@ namespace Avalonia.Controls.Notifications } else { - IDisposable stopListening = null; - - stopListening = Observable.FromEventPattern(host, nameof(host.TemplateApplied)) + Observable.FromEventPattern(host, nameof(host.TemplateApplied)).Take(1) .Subscribe(_ => { - stopListening.Dispose(); - Install(host); }); }