Skip to content

Use proper disposable for connection to message bus #390

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

Merged
merged 6 commits into from
Aug 30, 2022
Merged

Conversation

vol0n
Copy link
Member

@vol0n vol0n commented Aug 19, 2022

closes #389

  • Fix exception ClientLogger already disposed when opening multiple projects or opening one project several times. The cause was ApplicationManager.getApplication().messageBus.connect() in ClientManager instead of project.messageBus.connect()
  • Besides I added explicitly disposables when creating connections to message bus, in all cases it is project level service
  • Also changed messageBus.syncPublisher to if (!messageBus.isDisposed()) messageBus.syncPublisher. Not related to issue, but it should be this way

@@ -23,7 +22,7 @@ class ClientManager(val project: Project): Disposable {
}

private fun subscribeToEvents() {
with(ApplicationManager.getApplication().messageBus.connect()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Here was the cause for exception: after closing project this listeners was not disposed, because it had application lifetime

@vol0n vol0n requested a review from alexey-utkin August 19, 2022 10:55
@EgorkaKulikov EgorkaKulikov self-requested a review August 22, 2022 12:45
@vol0n vol0n requested a review from alexey-utkin August 29, 2022 08:41
@vol0n vol0n merged commit 6cc816c into main Aug 30, 2022
@sava-cska sava-cska deleted the vol0n/fix_listeners branch September 1, 2022 10:42
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.

[BUG] ClientLogger already disposed exception in CLion plugin
3 participants