Skip to content

Commit 9250bc3

Browse files
ferdnammahmoudian
andauthored
async-notification (#4759)
* async-notification The previous synchronous callWithArgumentList stalled the main thread for the QtDBus reply timeout (~25s) after every capture, freezing further captures until it returned. Probably related to Issue #2425. * Fix missing closing curly brace * clang-format --------- Co-authored-by: Mehrad Mahmoudian <m.mahmoudian@gmail.com>
1 parent c65fb77 commit 9250bc3

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/utils/systemnotification.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,16 @@ void SystemNotification::sendMessage(const QString& text,
9090
<< QStringList() // actions
9191
<< hintsMap // hints
9292
<< timeout; // timeout
93-
m_interface->callWithArgumentList(
94-
QDBus::AutoDetect, QStringLiteral("Notify"), args);
93+
// Fire-and-forget: an asynchronous call never blocks the event loop,
94+
// even when no notification daemon is registered on the session bus
95+
// (e.g. bare startx / tiling WM sessions). The previous synchronous
96+
// callWithArgumentList stalled the main thread for the QtDBus reply
97+
// timeout (~25s) after every capture, freezing further captures until
98+
// it returned.
99+
if (m_interface != nullptr) {
100+
m_interface->asyncCallWithArgumentList(QStringLiteral("Notify"),
101+
args);
102+
}
95103
}
96104
#endif
97105
}

0 commit comments

Comments
 (0)