Skip to content

Commit

Permalink
Merge pull request #12377 from ThereGoesMySanity/dbus-fallback-fix
Browse files Browse the repository at this point in the history
Catch dbus errors so that WatchAsync can register all names
  • Loading branch information
kekekeks authored Jul 30, 2023
2 parents 9808a44 + e1ac9be commit 6a80ef8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,15 @@ private async Task WatchAsync()
foreach (var name in _knownNames)
{
var dbus = new OrgFreedesktopDBus(Connection, "org.freedesktop.DBus", "/org/freedesktop/DBus");
_disposables.Add(await dbus.WatchNameOwnerChangedAsync(OnNameChange));
var nameOwner = await dbus.GetNameOwnerAsync(name);
OnNameChange(null, (name, null, nameOwner));
try
{
_disposables.Add(await dbus.WatchNameOwnerChangedAsync(OnNameChange));
var nameOwner = await dbus.GetNameOwnerAsync(name);
OnNameChange(null, (name, null, nameOwner));
}
catch (DBusException)
{
}
}
}

Expand Down

0 comments on commit 6a80ef8

Please sign in to comment.