Skip to content

Commit 6f25ae2

Browse files
committed
fix: fix null pointer crash in requestToken lambda
Use captured provider pointer instead of sender() which returns nullptr in lambda context and causes crash when calling deleteLater(). Fixes: sender()->deleteLater() crash
1 parent 1a41f5e commit 6f25ae2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/tray-wayland-integration/xdgactivationclient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void XdgActivationClient::requestToken(QWindow *window, const QString &appId, To
120120
auto *provider = m_activation->createTokenProvider(effectiveWindow, appId);
121121
m_pendingProvider = provider;
122122

123-
connect(provider, &XdgActivationTokenV1::done, this, [this, callback](const QString &token) {
123+
connect(provider, &XdgActivationTokenV1::done, this, [this, provider, callback](const QString &token) {
124124
m_pendingProvider = nullptr;
125125

126126
if (token.isEmpty())
@@ -129,7 +129,7 @@ void XdgActivationClient::requestToken(QWindow *window, const QString &appId, To
129129
qCDebug(trayXdgActivation) << "Activation token received";
130130

131131
if (callback) callback(token);
132-
sender()->deleteLater();
132+
provider->deleteLater();
133133
}, Qt::SingleShotConnection);
134134
}
135135

0 commit comments

Comments
 (0)