Skip to content

Commit

Permalink
fix(jsc): fix jsc memery release (Tencent#4155)
Browse files Browse the repository at this point in the history
  • Loading branch information
etkmao authored and wwwcg committed Dec 30, 2024
1 parent 4d3337c commit 94c1294
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
7 changes: 1 addition & 6 deletions driver/js/src/scope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,7 @@ Scope::Scope(std::weak_ptr<Engine> 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) {
Expand All @@ -145,7 +141,6 @@ Scope::~Scope() {
engine->ClearFunctionWrapper(key);
engine->ClearClassTemplate(key);
}
#endif
}

void Scope::WillExit() {
Expand Down
5 changes: 2 additions & 3 deletions framework/ios/base/executors/HippyJSExecutor.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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<hippy::napi::JSCCtx>(scope->GetContext());
if (self.pScope) {
auto jsc_context = std::static_pointer_cast<hippy::napi::JSCCtx>(self.pScope->GetContext());
static CFStringRef delName = CFSTR("HippyJSContext(delete)");
jsc_context->SetName(delName);
}
Expand Down

0 comments on commit 94c1294

Please sign in to comment.