Skip to content

Commit 6304ea6

Browse files
gnpricechrisbobbe
authored andcommitted
presence: Dispose Presence object when store disposed
I happened to notice this message getting printed repeatedly in the debug logs (reformatted a bit): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: NetworkException: HTTP request failed. Client is already closed. (ClientException: HTTP request failed. Client is already closed., uri=https://chat.zulip.org/api/v1/users/me/presence) #0 ApiConnection.send (package:zulip/api/core.dart:175) <asynchronous suspension> #1 Presence._maybePingAndRecordResponse (package:zulip/model/presence.dart:93) <asynchronous suspension> #2 Presence._poll (package:zulip/model/presence.dart:121) <asynchronous suspension> That'd be a symptom of an old Presence continuing to run its polling loop after the ApiConnection has been closed, which happens when the PerAccountStore is disposed. Looks like when we introduced Presence in 5d43df2 (#1619), we forgot to call its `dispose` method. Fix that now. The presence model doesn't currently have any tests. So rather than try to add a test for just this, we'll leave it as something to include when we write those tests, #1620.
1 parent 83a0b6f commit 6304ea6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/model/store.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ class PerAccountStore extends PerAccountStoreBase with
878878
recentDmConversationsView.dispose();
879879
unreads.dispose();
880880
_messages.dispose();
881+
presence.dispose();
881882
typingStatus.dispose();
882883
typingNotifier.dispose();
883884
updateMachine?.dispose();

0 commit comments

Comments
 (0)