From 5926437f55e09b3f229d6e1f23914f08815914c6 Mon Sep 17 00:00:00 2001 From: TameemAnsari-SF4702 Date: Mon, 17 Aug 2026 16:55:23 +0530 Subject: [PATCH] SfCarousel handler and platform view remain in memory after closing the page (iOSMac) --- .../src/Carousel/Platform/PlatformCarousel.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/maui/src/Carousel/Platform/PlatformCarousel.cs b/maui/src/Carousel/Platform/PlatformCarousel.cs index 7b150a96..bcf42a88 100644 --- a/maui/src/Carousel/Platform/PlatformCarousel.cs +++ b/maui/src/Carousel/Platform/PlatformCarousel.cs @@ -22,6 +22,31 @@ internal void Connect(ICarousel mauiView) /// internal void Disconnect() { +#if MACCATALYST || IOS + if (_handler != null) + { + if (GestureRecognizer != null) + { + RemoveGestureRecognizer(GestureRecognizer); + } + + foreach (var view in Subviews) + { + if (view is PlatformCarouselItem item) + { + item.InternalCarousel = null; + } + } + + _handler = null; + } +#elif ANDROID + if (carouselHandler != null) + { + carouselHandler = null; + } +#endif + _virtualView = null; }