Repository navigation
Bust plugin component URLs on hot-reload - #10576
fresh3nough wants to merge 1 commit into
Conversation
Qt.clearComponentCache is a QQmlEngine C++ method and is never exposed on the QML Qt object, so the guard in finishPluginReload was always false and rescan reused stale compiled components after plugin file edits. Advance a componentCacheEpoch before each rescan and append it as an omarchyReload query on entryPointUrl so Loaders re-read disk. Warn once when the C++ clear API is missing, and document restart-shell as the fallback if a reload still looks stale. Fixes #10568 Signed-off-by: fresh3nough <anonwurcod@proton.me>
|
Reviewed at eac7c4f. The diagnosis is right: What I checked, by reading only. Nothing was run on a worker, because a fix that isn't the recommended one isn't worth a worker:
#11408 handles a local Second opinion: Codex Medium compared the two PRs without being told my conclusion. It also preferred #11408, and it independently reached the directory-import explanation above, though its independence from this session isn't guaranteed. Waiting on the maintainer to choose between this PR and #11408. |
|
Looked at this again at eac7c4f, because the review of #13911 handed that PR's runtime test over to be folded in here. I haven't pushed it to this branch. It would only belong here if this were the fix being recommended, and it still isn't. The reason hasn't changed since the last review. I checked this by reading the three diffs against Still waiting on the maintainer to choose between this PR and #11408. If they choose this one, folding in the test from #13911 comes first. |
Summary
Fixes #10568.
finishPluginReloadguarded plugin hot-reload with:clearComponentCacheis aQQmlEngineC++ method and is not on the QMLQtobject, sotypeofis always"undefined", the call never runs, andrescan()re-instantiates the previous compiled component. Plugin file edits looked like no-ops.Change
PluginRegistry.componentCacheEpoch— advanced on each hot-reload.entryPointUrlappends?omarchyReload=<epoch>when the epoch is non-zero so Loader /createComponentURLs change and QML is re-read from disk.finishPluginReloadalways bumps the epoch beforerescan(), still callsQt.clearComponentCacheif a future Qt/Quickshell exposes it, and logs a one-shot WARN namingomarchy restart shellas fallback.rescanPluginsnote about cache-bust + restart fallback.Evidence
Bug reproduced
Pre-fix
finishPluginReloadonly cleared the cache inside that always-false guard.Fix validated
Test plan
clearComponentCachestill absent on QML Qtplugin-reload-cache-test.shplugin-registry-contract-test.sh(entryPointUrl epoch assertion)