Skip to content

Commit bada27a

Browse files
committed
review: check vm failure first
Signed-off-by: mathetake <[email protected]>
1 parent 74c1d83 commit bada27a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/context.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,21 @@ bool ContextBase::onStart(std::shared_ptr<PluginBase> plugin) {
331331
}
332332

333333
bool ContextBase::onConfigure(std::shared_ptr<PluginBase> plugin) {
334+
if (isFailed()) {
335+
return true;
336+
}
337+
338+
// on_context_create is yet to be executed for all the root contexts except the first one
334339
if (!in_vm_context_created_ && wasm_->on_context_create_) {
340+
DeferAfterCallActions actions(this);
335341
wasm_->on_context_create_(this, id_, 0);
336-
in_vm_context_created_ = true;
337342
}
338343

339-
if (isFailed() || !wasm_->on_configure_) {
344+
// NB: If no on_context_create function is registered the in-VM SDK is responsible for
345+
// managing any required in-VM state.
346+
in_vm_context_created_ = true;
347+
348+
if (!wasm_->on_configure_) {
340349
return true;
341350
}
342351

0 commit comments

Comments
 (0)