Introduce DisposableStore
Fixes #74242 Our current usage of dispoable arrays can leak disposables (see #74242 for details). This change introduces a new class called `DisposableStore` that can be used mostly as a drop in replacement for an array of disposables but will not leak disposbles if it is disposed `DisposableStore` was extracted from the existing `Dispoable` class, which already implements this pattern. However `Disposable` is intended to be used as a base class while `DispoableStore` is a value class. In addition, this change hides the `toDispose` / `_toDipose` members of `Disposable` as direct write access to the disposable array also allows for leaks (and breaks encapsulation)
Showing
想要评论请 注册 或 登录