Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[core] fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
jianhan-he committed Jan 3, 2019
1 parent cf9f457 commit 2e2c05d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,8 @@ - (void)destroyInstance:(NSString *)instance
WXPerformBlockOnComponentThread(^{
[WXCoreBridge destroyDataRenderInstance:instance];
});
} else {
[self callJSMethod:@"destroyInstance" args:@[instance]];
}
[self callJSMethod:@"destroyInstance" args:@[instance]];
}

- (void)forceGarbageCollection
Expand Down
6 changes: 5 additions & 1 deletion weex_core/Source/core/data_render/vnode/vcomponent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ VComponent::VComponent(ExecState *exec_state, int template_id,
root_vnode_(nullptr),
exec_state_(exec_state) {}

VComponent::~VComponent() {}
VComponent::~VComponent() {
if (listener_ && !has_moved_) {
listener_->OnDestroyed(this);
}
}

static bool Equals(Value a, Value b) {
if (a.type != b.type) {
Expand Down

0 comments on commit 2e2c05d

Please sign in to comment.