Skip to content

Fix chat history subscription retaining its controller - #301

Open
rfc9849 wants to merge 1 commit into
TelegramMessenger:masterfrom
rfc9849:fix/chat-history-retain-cycle
Open

rfc9849 wants to merge 1 commit into
TelegramMessenger:masterfrom
rfc9849:fix/chat-history-retain-cycle

Conversation

@rfc9849

@rfc9849 rfc9849 commented Nov 8, 2026 •

Copy link
Copy Markdown

Key change

Capture synchronized administrator-rank storage instead of ChatController in the history transformation, removing a retain cycle.

Reason

Fixes #300.

The self.currentRanks = data assignment introduced in b025afb makes the history subscription retain its owning controller. Cleanup runs from deinit, which the cycle prevents from running.

The change also synchronizes rank writes on the history queue with reads from UI actions.

Screenshot/video result (before/after)

No visual change is intended.

A standalone reproduction using the repository’s SwiftSignalKit confirms that the original capture retains its owner until the subscription is explicitly disposed. With the fix, all owners are released across 1,000 create/update/release cycles.

All four standalone checks passed in Debug, Release, and under Thread Sanitizer, including concurrent rank reads and writes.

Confirmation

Tested on macOS 27.2, local Release build 13.1.0 (283357). The full Release build passed and the application launches successfully.

Limitations: the standalone tests model subscription ownership rather than constructing a full ChatController. Controlled navigation/deallocation testing and manual administrator deletion-permission checks have not yet been performed.

  • I confirm that I have tested the affected behavior and verified that it works properly, or verified the content and links for a documentation-only change.

@macosswift

Copy link
Copy Markdown
Collaborator

This branch has conflicts that must be resolved

Please update this branch against master and resolve the merge conflicts so we can continue the review.

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.

Chat history subscription retains discarded ChatController instances

2 participants