Skip to content

Fix memory leaks from missing event unsubscriptions#795

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/identify-memory-leaks
Draft

Fix memory leaks from missing event unsubscriptions#795
Copilot wants to merge 2 commits intomainfrom
copilot/identify-memory-leaks

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

Description of Change

Audit of event subscription patterns across the codebase revealed three memory leaks where event handlers were never properly unsubscribed:

  • SearchBarHandler.cs (iOS) — Copy-paste bug: OnSearchButtonClicked was unsubscribed from CancelButtonClicked instead of SearchButtonClicked, so the search button handler was never cleaned up.
- platformView.CancelButtonClicked -= OnSearchButtonClicked;
+ platformView.SearchButtonClicked -= OnSearchButtonClicked;
  • CameraSession.cs (iOS)PreviewView.OnTapToFocus was subscribed in ConfigureAndStart() but missing from StopCameraSession() cleanup (the adjacent OnZoomChanged was correctly unsubscribed).

  • SlidableLayout.csTapGestureRecognizer was a local variable in the constructor, so its Tapped handler could never be unsubscribed in OnHandlerChanging(). Promoted to field m_tapGestureRecognizer alongside the existing m_panGestureRecognizer.

Todos

  • I have tested on an Android device.
  • I have tested on an iOS device.
  • I have supported accessibility

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…, SearchBarHandler, and SlidableLayout

Co-authored-by: Vetle444 <35739538+Vetle444@users.noreply.github.com>
Copilot AI changed the title [WIP] Identify possible memory leaks in the application Fix memory leaks from missing event unsubscriptions Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants