From d524f0a75632d8603e32b3ee7fe02138ff8343d1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 4 Sep 2023 06:26:16 +0400 Subject: [PATCH] QGenericUnixServices: ensure xdg activation token callback is called The callback doesn't get called if the signal is emitted immediately or if hitting the early returns Fixes: QTBUG-113995 Pick-to: 6.6 6.5 Change-Id: Ib3e1d324a2becd8148cd76b4441fce5c4cc725e8 Reviewed-by: David Redondo Reviewed-by: David Edmundson --- src/gui/platform/unix/qgenericunixservices.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/platform/unix/qgenericunixservices.cpp b/src/gui/platform/unix/qgenericunixservices.cpp index 88968413563..3a289cda452 100644 --- a/src/gui/platform/unix/qgenericunixservices.cpp +++ b/src/gui/platform/unix/qgenericunixservices.cpp @@ -421,6 +421,7 @@ void runWithXdgActivationToken(F &&functionToCall) QWindow *window = qGuiApp->focusWindow(); if (!window) { + functionToCall({}); return; } @@ -430,13 +431,14 @@ void runWithXdgActivationToken(F &&functionToCall) dynamic_cast(window->handle()); if (!waylandWindow || !waylandApp) { + functionToCall({}); return; } - waylandWindow->requestXdgActivationToken(waylandApp->lastInputSerial()); QObject::connect(waylandWindow, &QNativeInterface::Private::QWaylandWindow::xdgActivationTokenCreated, waylandWindow, functionToCall, Qt::SingleShotConnection); + waylandWindow->requestXdgActivationToken(waylandApp->lastInputSerial()); } bool QGenericUnixServices::openUrl(const QUrl &url)