kcmodule: Avoid crashing in KAuth::ExecuteJob after closing window
CC @davidedmundson, who suggested this QPointer-focused reading material in the original MR, instead of unprotected job->exec()
, but I thought I could do things properly and use async job->start()
instead. Turns out I made it worse instead. At least I got my KAuth helpers working timely enough to run into this crash before Beta 2.
Use a blocking job->exec()
instead to access charge thresholds.
Async is nice, but will crash when pressing OK instead of Apply. The window which has been set as parent window for the KAuth helper dialog will disappear, and KAuth::ExecuteJob will crash inside QWaylandIntegration::createPlatformWindow() which QWindow::winId() depends on but fails. On Qt 6.6.1 at least.
Let's avoid this crash until there's a better fix.