File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -134,10 +134,14 @@ class WasmBase : public std::enable_shared_from_this<WasmBase> {
134134
135135 void addAfterVmCallAction (std::function<void ()> f) { after_vm_call_actions_.push_back (f); }
136136 void doAfterVmCallActions () {
137- while (!after_vm_call_actions_.empty ()) {
138- auto f = std::move (after_vm_call_actions_.front ());
139- after_vm_call_actions_.pop_front ();
140- f ();
137+ // NB: this may be deleted by a delayed function unless prevented.
138+ if (!after_vm_call_actions_.empty ()) {
139+ auto self = shared_from_this ();
140+ while (!self->after_vm_call_actions_ .empty ()) {
141+ auto f = std::move (self->after_vm_call_actions_ .front ());
142+ self->after_vm_call_actions_ .pop_front ();
143+ f ();
144+ }
141145 }
142146 }
143147
You can’t perform that action at this time.
0 commit comments