From 91619f0e76a3d07d7ffdad8d4d7f9b54bf573cfd 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 Change-Id: Ib3e1d324a2becd8148cd76b4441fce5c4cc725e8 Reviewed-by: David Redondo Reviewed-by: David Edmundson (cherry picked from commit d524f0a75632d8603e32b3ee7fe02138ff8343d1) Reviewed-by: Qt Cherry-pick Bot --- 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 34d9c37e246..362c55c17e1 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)