Browse Source

Fix DBus Exception on window close (#13997)

* Only disconnect from ibus when connected

* Catch exception on Destroy when ime context is successfully created but doesn't actually exist
pull/13976/head
affederaffe 3 years ago
committed by GitHub
parent
commit
8756feff5d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs

15
src/Avalonia.FreeDesktop/DBusIme/DBusTextInputMethodBase.cs

@ -179,12 +179,23 @@ namespace Avalonia.FreeDesktop.DBusIme
_disposables.Add(d);
}
public void Dispose()
public async void Dispose()
{
foreach(var d in _disposables)
d.Dispose();
_disposables.Clear();
_ = DisconnectAsync();
if (!IsConnected)
return;
try
{
await DisconnectAsync();
}
catch (Exception ex)
{
Logger.TryGet(LogEventLevel.Error, "IME")
?.Log(this, "Error while destroying the context:\n" + ex);
}
_currentName = null;
}

Loading…
Cancel
Save