Summary: | Opened windows are not getting drawn when 'Show Desktop' is abused in a loop | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | valdikss |
Component: | effects-window-management | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | RESOLVED UPSTREAM | ||
Severity: | grave | CC: | bharadwaj.raju777, butirsky, Markus.Elfring, nate, rmedeirosflavio, szymondudek9, till2.schaefer |
Priority: | VHI | Keywords: | regression |
Version: | 5.22.90 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
URL: | https://codereview.qt-project.org/c/qt/qtdeclarative/+/376014 | ||
See Also: |
https://bugs.kde.org/show_bug.cgi?id=442649 https://bugs.kde.org/show_bug.cgi?id=439815 |
||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Kde show desktop bug video demo
qjsengine bug reproducer |
Note that keyboard repeat rate could be very low to trigger this bug, so it doesn't seem like race condition. The video has repeat rate of 3 per second. I can confirm this. I just started seeing it yesterday on Wayland and found that I could reproduce it pretty reliably by showing the Widget Explorer (which automatically invokes Present Windows), dragging a widget to the desktop, and interacting with the desktop at all. Thereafter, the Present Windows effect has restored all the windows, but they are invisible. If I quit an affected app and re-launch it, its window is rendered properly. *** Bug 442411 has been marked as a duplicate of this bug. *** I apologize for previously creating a duplicate report of this one. I said that I had issues when running under xrender also, however it was a mistake I no longer have such issues in kwin, expect when utilizing any opengl compositor. Thanks for the attention. I just hit this effect when using the Eye On Screen effect instead of Window Aperture, so it doesn't seem specific to that effect. Notably, I also just discovered opening System Settings and switching from one effect to the other makes all the missing windows re-appear. When we change the options "Show Desktop" to "Minimize all Windows" another problem occurs ( Wayland only ) . Depending on what application is active ( window ) this function works as expected. But when we reshuffle the windows activity , there is a problem. Description of the Problem : The windows hide, but after clicking again they do not show up. They are still hidden and this function does not work until we manually restore the windows one by one. Opening the Problem : Launch the Dolphin and Kate applications. Make sure that the windows are visible on your screen. And then remember which window was active. Use the Minimize all Windows function twice via shortcut or applet. If the windows are still active the second time, change the windows activity to the other application and use the function twice again. PS. I am not quite sure if the function error itself occurs only when using it , or for other reasons. However, if the problem does not appear, please use more applications, and change their activity, surely it will appear. *** Bug 442649 has been marked as a duplicate of this bug. *** I don't know if something recent fixed this, but I'm no longer able to reproduce the issue with today's git master. I realize it's been a few days since it happened to me, whereas before I was hitting it at least once a day, sometimes more often. The bug still exists in KDE Plasma Version: 5.22.5 KDE Frameworks Version: 5.85.0 Created attachment 142167 [details]
qjsengine bug reproducer
I found a reliable way to reproduce the issue in QJSEngine. Key points:
* several engines need to work with the same qobject
* if garbage collector runs at some specific point, it seems like qobject wrappers will be destroyed
if you run the demo, you're going to see
js: customProp2 was stripped away for EffectWindow(0x55d553dc1d50)
js: customProp2 was stripped away for EffectWindow(0x55d553dc1b30)
js: customProp2 was stripped away for EffectWindow(0x55d553dc1f70)
ideally, the demo should not print anything.
I think I found the culprit of this bug. The garbage collector seems to prefer to keep "null or undefined" qobject wrappers in MemoryManager::sweep() https://code.woboq.org/qt5/qtdeclarative/src/qml/memory/qv4mm.cpp.html#983 if (MultiplyWrappedQObjectMap *multiplyWrappedQObjects = engine->m_multiplyWrappedQObjects) { for (MultiplyWrappedQObjectMap::Iterator it = multiplyWrappedQObjects->begin(); it != multiplyWrappedQObjects->end();) { if (!it.value().isNullOrUndefined()) it = multiplyWrappedQObjects->erase(it); else ++it; } } That looks very sketchy. If `!it.value().isNullOrUndefined()` is changed to `it.value().isNullOrUndefined()`, tainted qobject wrappers don't get destroyed. Vlad's patch (https://codereview.qt-project.org/c/qt/qtdeclarative/+/376014) has been merged, so this is officially fixed in Qt. We'll see about backporting the fix to the KDE patch collection for Qt 5.15. Qt backport request: https://invent.kde.org/qt/qt/qtdeclarative/-/merge_requests/8 *** Bug 443633 has been marked as a duplicate of this bug. *** *** Bug 444610 has been marked as a duplicate of this bug. *** |
Created attachment 140589 [details] Kde show desktop bug video demo SUMMARY Using 'Show Desktop' function multiple (tens) times result in all opened windows on current desktop to not render at all. They act as they are shown on desktop, but no elements are drawn, not even window header. STEPS TO REPRODUCE 1. Open any graphical application, say Kate. 2. Press and hold CTRL+F12 (default 'show desktop' combination) for 10-30 seconds. OBSERVED RESULT Kate window is not displayed on screen while still present in task manager. You can 'minimize' and 'restore' the window, the cursor changes its shape where Kate text field should be shown, but the window is just not rendered: not the content, not the WM header with title and buttons. EXPECTED RESULT Window is rendered as usual. SOFTWARE/OS VERSIONS Operating System: Fedora 34 KDE Plasma Version: 5.22.4 KDE Frameworks Version: 5.83.0 Qt Version: 5.15.2 Kernel Version: 5.13.6-200.fc34.x86_64 (64-bit) Graphics Platform: X11 Graphics Processor: Mesa DRI Intel® HD Graphics 3000 ADDITIONAL INFORMATION Please watch the video if the text description is confusing. I'm not sure whether this is a kwin or plasma bug. Filing it as kwin bug (as even window decorations are not shown), please reassign if necessary.