From 4a52bb744af0d8548e911ce7277ac0454b94ccfc Mon Sep 17 00:00:00 2001 From: scorpion-26 Date: Fri, 28 Jul 2023 18:58:00 +0200 Subject: [PATCH] SNI: Flush before querying item properties Some apps have a tendency to deadlock after registration (notably KeePassXC). Now we flush before querying the item properties, so any pending answer should have left the bus, hopefully avoiding the deadlock --- src/SNI.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/SNI.cpp b/src/SNI.cpp index 3dc6233..a6df00f 100644 --- a/src/SNI.cpp +++ b/src/SNI.cpp @@ -325,6 +325,15 @@ namespace SNI static TimerResult UpdateWidgets(Box&) { + // Flush connection, so we hopefully don't deadlock with any client + GError* err = nullptr; + g_dbus_connection_flush_sync(dbusConnection, nullptr, &err); + if (err) + { + LOG("SNI: g_dbus_connection_call_sync failed: " << err->message); + g_error_free(err); + } + if (RuntimeConfig::Get().hasSNI == false || Config::Get().enableSNI == false) { // Don't bother