Skip to content

Fix memory leak on frame observer#141

Merged
SvenTiigi merged 1 commit intoSvenTiigi:developfrom
Katsz:main
Oct 15, 2025
Merged

Fix memory leak on frame observer#141
SvenTiigi merged 1 commit intoSvenTiigi:developfrom
Katsz:main

Conversation

@Katsz
Copy link
Contributor

@Katsz Katsz commented Oct 15, 2025

Hi there 👋

This PR addresses a memory leak (see #37 [and maybe #131]) caused by a strong capture of YouTubePlayerWebView inside its frameChangesCancellable. Weakifying self inside the Task had no effect, since the view was already strongly captured by the sink, preventing proper deallocation of the NSKVOObserver and WebView itself.

In practice, this will cause the player to leak and, if the player is closed before the video starts, audio might continue playing in the background with no way to stop it.

This change weakens the self capture in sink to ensure proper cleanup.

@Katsz Katsz marked this pull request as ready for review October 15, 2025 13:45
@SvenTiigi SvenTiigi changed the base branch from main to develop October 15, 2025 17:13
@SvenTiigi
Copy link
Owner

LGTM 👍

@SvenTiigi SvenTiigi merged commit ad735f9 into SvenTiigi:develop Oct 15, 2025
1 of 4 checks passed
@SvenTiigi
Copy link
Owner

Changes are available with the latest release 2.0.4

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