diff --git a/driver/js/src/scope.cc b/driver/js/src/scope.cc index 88365bf292f..084187de472 100644 --- a/driver/js/src/scope.cc +++ b/driver/js/src/scope.cc @@ -132,11 +132,7 @@ Scope::Scope(std::weak_ptr engine, Scope::~Scope() { FOOTSTONE_DLOG(INFO) << "~Scope"; -#ifdef JS_JSC -/* - * JSObjectFinalizeCallback will be called when you call JSContextGroupRelease, so it is necessary to hold the wrapper when ctx is destroyed. - */ -#else + context_ = nullptr; auto engine = engine_.lock(); FOOTSTONE_DCHECK(engine); if (engine) { @@ -145,7 +141,6 @@ Scope::~Scope() { engine->ClearFunctionWrapper(key); engine->ClearClassTemplate(key); } -#endif } void Scope::WillExit() { diff --git a/framework/ios/base/executors/HippyJSExecutor.mm b/framework/ios/base/executors/HippyJSExecutor.mm index d401c9c6cca..ccc97a60707 100644 --- a/framework/ios/base/executors/HippyJSExecutor.mm +++ b/framework/ios/base/executors/HippyJSExecutor.mm @@ -237,9 +237,8 @@ - (void)invalidate { HippyLogInfo(@"[Hippy_OC_Log][Life_Circle],HippyJSCExecutor invalide %p", self); _valid = NO; #ifdef JS_JSC - auto scope = self.pScope; - if (scope) { - auto jsc_context = std::static_pointer_cast(scope->GetContext()); + if (self.pScope) { + auto jsc_context = std::static_pointer_cast(self.pScope->GetContext()); static CFStringRef delName = CFSTR("HippyJSContext(delete)"); jsc_context->SetName(delName); }