File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,9 +111,18 @@ struct StripModule : StripModuleBase, StripIdFixModule {
111111 void onReset (const ResetEvent& e) override {
112112 randomParamsOnly = false ;
113113 presetLoadReplace = false ;
114- // Initialize snapshot to empty set so UI can read safely immediately
115- excludedParams.clear ();
116- excludedParamsPtr.store ({});
114+ // excludedParams and its engine->UI snapshot (excludedParamsPtr) are owned by
115+ // the engine thread. onReset may run on the UI/main thread (e.g. "Initialize"
116+ // from the context menu), so clearing them inline would make both the UI thread
117+ // and the engine thread write the same SpscLatestValue, breaking its strict
118+ // single-writer contract and corrupting the heap. Defer the clear to the engine
119+ // thread via the same task mechanism used by every other exclude mutation.
120+ // (SpscLatestValue default-constructs to an empty set, so UI reads stay safe
121+ // until the task runs on the next process() tick.)
122+ groupExcludeClearRequest ();
123+ // excludedParamsPtrUi is the UI->engine channel; its writer is the UI/main
124+ // thread, so resetting it here is safe and prevents a stale snapshot from
125+ // being reloaded later.
117126 excludedParamsPtrUi.store ({});
118127 Module::onReset (e);
119128 }
You can’t perform that action at this time.
0 commit comments