Scenario: guard TimeSync execution component against use after cleanup - #2113
Scenario: guard TimeSync execution component against use after cleanup#2113bltzr wants to merge 2 commits into
Conversation
cleanup() resets m_ossia_node while the component's destruction is deferred through the execution queue. Model edits arriving in that window (autotrigger toggles, trigger/expression changes, quantization changes, GUI trigger) would then dereference a null node in the exec lambda, or trip SCORE_ASSERT in updateTrigger(). Bail out early when m_ossia_node is null.
|
I am a little unsure about this one. Claude made it following a crash I had but I'm not sure... |
| start = m_score_node->isStartPoint(); | ||
| } | ||
|
|
||
| SCORE_ASSERT(m_ossia_node); |
There was a problem hiding this comment.
Why was this assert removed ? It's a safeguard: if it triggers it means that something else before it is wrong and has to be fixed
There was a problem hiding this comment.
I guess we can lower the "expectations" but it leads to worsening of the understandability of the codebase since it creates more potential code paths
…ding Review rework: restore SCORE_ASSERT(m_ossia_node) and drop the null guards. Root cause of the post-cleanup calls: cleanup() resets m_ossia_node immediately, but the component's destruction is deferred through the exec queue and then the gc queue while the model stays alive and editable — so a trigger/autotrigger/quantization edit after stop still fired the ctor connections into the half-dead component. Disconnecting the model from the component in cleanup() severs every such path (all guarded methods are reachable only through those connections), keeping the invariant instead of widening the code paths. Co-Authored-By: Claude <noreply@anthropic.com>
|
Fair — reworked (99835c5): the assert is restored and the guards are gone. Root cause found: Found while auditing, three things you may want to weigh in on:
|
|
@claude trace the whole dataflow and state machine after timesynccomponent, eventcomponent, statecomponent, intervalcomponent, scenariocomponent, etc. end in "cleanup": can they ever be recreated? If not, extend the patch with the same fixes to the other types |
TimeSyncComponent::cleanup()resetsm_ossia_nodewhile the component's destruction is deferred through the execution queue. If the model is edited in that window — toggling autotrigger, changing the trigger expression, changing quantization, or a GUI trigger — the UI-thread handlers still fire and either dereference a null node inside thein_execlambda or tripSCORE_ASSERT(m_ossia_node)inupdateTrigger().Guard each of those entry points with an early return when
m_ossia_nodeis null.🤖 Generated with Claude Code
https://claude.ai/code/session_019ya5qsdZbjVtA697QUhJFz