comments: fix listener leak in mainThreadComments (#312613)
onResourceHasCommentingRanges and onDidUpdateCommentThreads were subscribed in $registerCommentController using this._register(), which appends to the class-level DisposableStore. Each call to $registerCommentController (one per comment provider extension) added a new pair of permanent listeners, causing unbounded accumulation.
Both listeners only call registerView(), which is idempotent, and have no per-controller dependency. Move them to the constructor so they're registered exactly once.
This regression was introduced by f64aa5122e5 ("Comments panel appears without having GHPR installed") which changed from eager view registration to lazy/event-driven, but accidentally put the subscriptions in a per-controller method. The lazy behavior is registerView() still only fires when comments actually exist.preserved
Fixes a regression of #243841.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> R
Rob Lourens committed
8ff524244395bd0a3d40829f13a3594540767d28
Parent: 6c5bcb5
Committed by GitHub <noreply@github.com>
on 4/27/2026, 8:11:19 AM