Skip to content

Commit

Permalink
fix(android): Release the call after reject/resolve (#4318)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Mar 17, 2021
1 parent 5bc82f6 commit a9f30a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Expand Up @@ -109,6 +109,9 @@ public void sendResponseMessage(PluginCall call, PluginResult successResult, Plu
} catch (Exception ex) {
Logger.error("sendResponseMessage: error: " + ex);
}
if (!call.isKeptAlive()) {
call.release(bridge);
}
}

private void callPluginMethod(String callbackId, String pluginId, String methodName, JSObject methodData) {
Expand Down
9 changes: 0 additions & 9 deletions android/capacitor/src/main/java/com/getcapacitor/Plugin.java
Expand Up @@ -140,10 +140,6 @@ private void triggerPermissionCallback(Method method, Map<String, Boolean> permi

// validate permissions and invoke the permission result callback
if (bridge.validatePermissions(this, savedCall, permissionResultMap)) {
if (!savedCall.isKeptAlive()) {
savedCall.release(bridge);
}

try {
method.setAccessible(true);
method.invoke(this, savedCall);
Expand All @@ -158,11 +154,6 @@ private void triggerActivityCallback(Method method, ActivityResult result) {
if (savedCall == null) {
savedCall = bridge.getPluginCallForLastActivity();
}

if (!savedCall.isKeptAlive()) {
savedCall.release(bridge);
}

// invoke the activity result callback
try {
method.setAccessible(true);
Expand Down

0 comments on commit a9f30a8

Please sign in to comment.