Commit 262389b1 authored by David Edmundson's avatar David Edmundson
Browse files

Avoid creating subwindow on internal page widget

KWallet::openWallet takes a windowId as a parameter.

QWidget->winId() is a dangerous call, it will create an underlying
platform window when called. This happens even if we're not the toplevel
widget. On X11 this passed winId must have always been broken, but not
in a way that caused a problem.

This leaves QtWayland in a very confused state with the side effect that
all scrolling widgets become broken.

BUG: 418755
BUG: 420035

Test Plan:
Bisected drkonqi till we found the cause
Verified fix by running crashtest (with some mods so I could report a bug)
I can't confirm the winId is correct on X11, but the code looks safe

Reviewers: #plasma, sitter

Reviewed By: sitter

Subscribers: sitter, plasma-devel

Tags: #plasma

Differential Revision:
parent 113b91bf
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QTextBrowser> #include <QTextBrowser>
#include <QDesktopServices> #include <QDesktopServices>
#include <QWindow>
#include "drkonqi_debug.h" #include "drkonqi_debug.h"
#include <KMessageBox> #include <KMessageBox>
...@@ -170,9 +171,16 @@ void BugzillaLoginPage::openWallet() ...@@ -170,9 +171,16 @@ void BugzillaLoginPage::openWallet()
{ {
//Store if the wallet was previously opened so we can know if we should close it later //Store if the wallet was previously opened so we can know if we should close it later
m_walletWasOpenedBefore = KWallet::Wallet::isOpen(KWallet::Wallet::NetworkWallet()); m_walletWasOpenedBefore = KWallet::Wallet::isOpen(KWallet::Wallet::NetworkWallet());
//Request open the wallet //Request open the wallet
m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), WId windowId = 0;
static_cast<QWidget*>(this->parent())->winId()); const auto *widget = qobject_cast<QWidget*>(this->parent());
QWindow *window = widget->windowHandle();
if (window) {
windowId = window->winId();
m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), windowId);
} }
void BugzillaLoginPage::walletLogin() void BugzillaLoginPage::walletLogin()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment