fix(PlanView): reload mission item editors from tree root to avoid stale-delegate loads#14668
Closed
DonLakeFlyer wants to merge 1 commit into
Closed
fix(PlanView): reload mission item editors from tree root to avoid stale-delegate loads#14668DonLakeFlyer wants to merge 1 commit into
DonLakeFlyer wants to merge 1 commit into
Conversation
DonLakeFlyer
force-pushed
the
fix-plantree-stale-editor-reload
branch
from
July 21, 2026 03:43
478285e to
3aa8786
Compare
…ale-delegate loads MissionItemEditor used a Connections on its missionItem to reload the editor Loader whenever isCurrentItemChanged fired. TreeView releases delegates with reuseItems: false by invalidating their QML context immediately while deferring object destruction via deleteLater. In that window the Connections to the persistent MissionItem still fires, and the Loader's setSource() then attempts a component load in the invalidated context, producing: QQmlContext: Cannot set context object on invalid context. QQmlComponent: Cannot create a component in an invalid context which fails PlanViewLayerUITest under strict-mode log checking. The race only triggers when delegate teardown (layer switch, group collapse, forceLayout) coincides with a current-item change - e.g. takeoff item insertion - and is far more likely on slow CI runners. Invert the control: remove the per-delegate Connections and have PlanTreeView (whose root outlives all delegates) react to MissionController::planViewStateChanged and call reloadEditor() only on delegates that are still live via itemAtCell(). Newly created delegates load their editor from Component.onCompleted as before.
DonLakeFlyer
force-pushed
the
fix-plantree-stale-editor-reload
branch
from
July 21, 2026 03:54
3aa8786 to
2c2df3a
Compare
Contributor
|
See the Build Results workflow run for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PlanViewLayerUITest fails intermittently in CI (most recently on #14667) with strict-mode log failures:
This is the CI-only "invalid context" flavor noted as unresolved in #14638 ("never reproduced locally in ~340 runs... if it recurs in CI after this change it can be hunted separately"). It recurred.
Root cause
MissionItemEditor.qmlused aConnections { target: missionItem }to reload its editorLoaderonisCurrentItemChanged.TreeView(withreuseItems: false) releases delegates by invalidating their QML context immediately while deferring actual destruction viadeleteLater. In that window theConnectionsto the persistentMissionItemC++ object still fires, andLoader.setSource()attempts a component load in the invalidated context.QQuickLoaderPrivate::_q_sourceLoaded()then doesnew QQmlContext(creationContext)+setContextObject()on the dead context — producing exactly the two warnings above.The race needs delegate teardown (layer switch / group collapse /
forceLayout) to coincide with a current-item change — e.g. the takeoff-item insertion in test step 2.2 — and is far more likely on slow CI runners, which is why it never reproduced locally.Fix
Invert the control:
ConnectionsfromMissionItemEditor.qml; rename_loadEditor()to publicreloadEditor().PlanTreeView.qml(whose root outlives all delegates) reacts toMissionController::planViewStateChanged— emitted whenever the current plan-view item changes — and callsreloadEditor()only on delegates that are still live, viaitemAtCell()over the visible rows. Released delegates are unreachable throughitemAtCell, so no load can ever be triggered in an invalidated context.Component.onCompleted.Testing