Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix two bugs in #214589 fixing #213535. #218357

Merged
merged 4 commits into from
Jun 26, 2024

Conversation

rehmsen
Copy link
Contributor

@rehmsen rehmsen commented Jun 26, 2024

  1. We must not dispose() the MutableDisposable this._commentThreadWidget - as that disposes the MutableDisposable itself, and it cannot then later be reassigned to a new value. Instead, we need to assign value=undefined, which disposes the previous value, but keeps the MutableDisposable available to be reused later.
  2. initialize() is a no-op if this.currentElement is already identical to the passed element, so we must not do that assignment before calling initialize - instead initialize() does the assignment after checking.

@rebornix or @alexr00, could you please take a look?

1. We must not `dispose()` the `MutableDisposable` `this._commentThreadWidget` - as that disposes the MutableDisposable itself, and it cannot then later be reassigned to a new value. Instead, we need to assign `value=undefined`, which disposes the previous `value`, but keeps the `MutableDisposable` available to be reused later.
2. `initialize()` is a no-op if `this.currentElement` is already identical to the passed `element`, so we must not do that assignment before calling initialize - instead `initialize()` does the assignment after checking.
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment:

Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@alexr00 alexr00 enabled auto-merge (squash) June 26, 2024 15:17
@vscodenpa vscodenpa added this to the June 2024 milestone Jun 26, 2024
@alexr00 alexr00 merged commit a11a0d7 into microsoft:main Jun 26, 2024
6 checks passed
aaronchucarroll pushed a commit to aaronchucarroll/vscode that referenced this pull request Jul 10, 2024
…218357)

* Fix two bugs in microsoft#214589.

1. We must not `dispose()` the `MutableDisposable` `this._commentThreadWidget` - as that disposes the MutableDisposable itself, and it cannot then later be reassigned to a new value. Instead, we need to assign `value=undefined`, which disposes the previous `value`, but keeps the `MutableDisposable` available to be reused later.
2. `initialize()` is a no-op if `this.currentElement` is already identical to the passed `element`, so we must not do that assignment before calling initialize - instead `initialize()` does the assignment after checking.

* Fix blank line.

* Register the _commentThreadWidget MutableDisposable so that it gets disposed when CellComments is disposed.
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Aug 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants