Skip to content

Remove dead Qt.clearComponentCache guard from plugin reload - #10070

Closed
fresh3nough wants to merge 1 commit into
omacom:quattrofrom
fresh3nough:fix/9772-dead-clearcomponentcache
Closed

fresh3nough wants to merge 1 commit into
omacom:quattrofrom
fresh3nough:fix/9772-dead-clearcomponentcache

Conversation

@fresh3nough

Copy link
Copy Markdown
Contributor

Summary

finishPluginReload() guarded a call to Qt.clearComponentCache() behind typeof Qt.clearComponentCache === "function". That API is C++ only (QQmlEngine::clearComponentCache()) and has never been exported to QML, so the call never ran.

The engine caches component types, script imports, and directory listings. When a plugin adds new files while the shell is running, those stale caches can cause File name case mismatch errors for files that exist at the correct path.

Fix

Remove the dead guard and document that the QML engine caches are not cleared on reload. A plugin that adds new files after the shell starts may require a restart.

Fixes #9772

Test plan

  • Confirmed typeof Qt.clearComponentCache guard present on quattro
  • bash test/shell.d/plugin-reload-cache-test.sh

Qt.clearComponentCache is a C++ API (QQmlEngine), never exposed to QML.
The typeof guard was always false, so the cache was never cleared during
hot reload. Remove the dead call and document the known limitation.

Fixes #9772

Signed-off-by: fresh3nough <anonwurcod@proton.me>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed against quattro at 821ae58. The diagnosis is right: clearComponentCache() is a C++ method on QQmlEngine and is not exposed on the QML Qt object, so the guard in finishPluginReload() is always false and the call never runs. Removing it changes nothing at runtime, though. Plugins are still torn down and rebuilt from the stale cached components, so this pull request does not fix the bug in #9772. That issue was closed as a duplicate of #6981, which is still open.

Three other open pull requests change the same line and actually fix #6981:

Of these, #8766 fixes the cause most directly. Whichever fix lands removes or rewrites this line anyway, so the cleanup here is better folded into it than merged on its own. A few smaller points, in case this one is kept:

  • Fixes #9772 claims a fix this change does not make. Related to #6981 would be accurate.
  • The four-line comment says that newly added files need a restart, but edits to existing plugin files stay stale too.
  • The test checks for exact source and comment strings rather than reload behaviour. Its rescan() and !shell.pluginReloading checks match anywhere in the file, not just inside finishPluginReload(). The file also has no trailing newline.

I read the four diffs, and Codex at medium effort reviewed them separately. It put #8766 first and this pull request last, as I did. It raised the test-path collision with #10576 and the comment's gap about edited files, and I checked both against the diffs. Its agreement with the ranking is not guaranteed to be independent. Nothing was run on a worker, because this change has no runtime effect to reproduce. Which reload fix to take is up to the maintainer. #8766 and #7771 currently conflict with quattro.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this, @fresh3nough. #8766 got there first with a fix for the same problem, so this is closed in favour of it, and the credit stays with the first fix. If it does not cover your case, please say so there.

Closed at the maintainer's request. The review comment above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin hot reload never clears the QML component cache: Qt.clearComponentCache is not a QML API, so the guard at shell.qml:757 is always false

2 participants