https://bugs.kde.org/show_bug.cgi?id=481007

            Bug ID: 481007
           Summary: kwin tabbox caching issue: use
                    m_qmlContext.trimComponentCache()
    Classification: Plasma
           Product: kwin
           Version: 5.93.0
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: tabbox
          Assignee: kwin-bugs-n...@kde.org
          Reporter: benjaminfle...@icloud.com
  Target Milestone: ---

SUMMARY
***
Background: As a theme developer, I want to create a WindowSwitcher.qml theme.
If the WindowSwitcher.qml file has an error, kwin will not load it and show
desktop notification. When I fix the error in the QML file and then try again,
kwin still loads the cached file BUT the error message kwin gives points to the
new file. 

This suggests that the QMLEngine used in kwin tabbox is polluted with the old
QML component.

The call to `m_qmlComponent.reset(nullptr)` in [1] is not enough to clear the
invalid QML file from the cache. A call to `m_qmlContext.trimComponentCache()`
[2] should be added. However, as trimComponentCache() only deletes unused
components, we need to reset m_qmlComponent before we can trim the cache. As
m_qmlComponent is null after the reset, we need to use m_qmlContext instead,
which points to the same QMLEngine.

***

[1]
https://invent.kde.org/bf/kwin-fix-tabbox-cache/-/blob/master/src/tabbox/tabboxhandler.cpp#L251
[2] https://doc.qt.io/qt-6/qqmlengine.html#trimComponentCache

Log: PLEASE NOTE that the first error message shows the "erroneous" line
properly, but the second kwin error message shows the fixed file (which should
compile!), however it still gives an error.

-----8<-----
kwin_wayland[15029]: kwin_tabbox: Component failed to load: 
QList(file:///mytheme/contents/windowswitcher/WindowSwitcher.qml:9:1: module
"QtGraphicalEffects" is not installed
import QtGraphicalEffects 1.12
^)
kwin_wayland[15029]: kwin_tabbox: ==  "Alt+Tab"  or  "Alt+Shift+Backtab"
kwin_wayland[15029]: kwin_tabbox: Component failed to load: 
QList(file:///mytheme/contents/windowswitcher/WindowSwitcher.qml:9:1: module
"QtGraphicalEffects" is not installed
// import QtGraphicalEffects 1.12
^)
----->8-----

STEPS TO REPRODUCE
1. create custom plasma lookandfeel theme with a QML file with syntax errors in
`contents/windowswitcher/WindowSwitcher.qml` 
2. load the plasma global theme via `plasma-apply-lookandfeel -a $(pwd)`
3. press ALT+TAB to trigger KWIN error message in journalctl
4. change the file to fix the error
5. press ALT+TAB again and see that KWIN has still same error, but the KWIN
error message points to the now fixed line in the QML file


OBSERVED RESULT
QML file does not get re-read from filesystem

EXPECTED RESULT
QML file is re-read from filesystem

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux 6.7.4-arch1-1
KDE Plasma Version: 5.93.0-1
KDE Frameworks Version: 5.114.0-2
Qt Version: 6.7.0beta2-1

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to