Feature/zpf (#564)
* iOS: fix memory leak of blur effect * js: fix callback cause memory leak
This commit is contained in:
@@ -1258,6 +1258,9 @@ function jsCallResolve(contextId, callbackId, args) {
|
||||
}
|
||||
hookBeforeNativeCall(context);
|
||||
Reflect.apply(callback.resolve, context, argumentsList);
|
||||
if (callback.retained !== true) {
|
||||
context.callbacks.delete(callbackId);
|
||||
}
|
||||
}
|
||||
function jsCallReject(contextId, callbackId, args) {
|
||||
const context = gContexts.get(contextId);
|
||||
@@ -1276,6 +1279,9 @@ function jsCallReject(contextId, callbackId, args) {
|
||||
}
|
||||
hookBeforeNativeCall(context);
|
||||
Reflect.apply(callback.reject, context.entity, argumentsList);
|
||||
if (callback.retained !== true) {
|
||||
context.callbacks.delete(callbackId);
|
||||
}
|
||||
}
|
||||
class Context {
|
||||
constructor(id) {
|
||||
@@ -1339,7 +1345,8 @@ class Context {
|
||||
const functionId = uniqueId('function');
|
||||
this.callbacks.set(functionId, {
|
||||
resolve: func,
|
||||
reject: () => { loge("This should not be called"); }
|
||||
reject: () => { loge("This should not be called"); },
|
||||
retained: true,
|
||||
});
|
||||
return functionId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user