Skip to content

Commit

Permalink
Fix DBusClient._removeMatch()
Browse files Browse the repository at this point in the history
Reset the reference count before awaiting the RemoveMatch() D-Bus call
to prevent that a reference goes missing if _addMatch() increases the
reference count during the await.

Related issue: #293
  • Loading branch information
jpnurmi authored and robert-ancell committed Dec 7, 2021
1 parent ba26702 commit 1270d45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/dbus_client.dart
Expand Up @@ -872,6 +872,7 @@ class DBusClient {
}

if (count == 1) {
_matchRules.remove(rule);
if (!_socketClosed) {
await callMethod(
destination: 'org.freedesktop.DBus',
Expand All @@ -881,7 +882,6 @@ class DBusClient {
values: [DBusString(rule)],
replySignature: DBusSignature(''));
}
_matchRules.remove(rule);
} else {
_matchRules[rule] = count - 1;
}
Expand Down

0 comments on commit 1270d45

Please sign in to comment.