fix:when onDestroy call native plugin

This commit is contained in:
pengfei.zhou
2020-04-23 17:42:32 +08:00
committed by osborn
parent 82fdd5e46c
commit 496c4c1838
8 changed files with 34 additions and 19 deletions

View File

@@ -163,17 +163,29 @@ public class DoricContext {
}
public void teardown() {
callEntity(DoricConstant.DORIC_ENTITY_DESTROY);
getDriver().asyncCall(new Callable<Object>() {
callEntity(DoricConstant.DORIC_ENTITY_DESTROY).setCallback(new AsyncResult.Callback<JSDecoder>() {
@Override
public Object call() {
for (DoricJavaPlugin javaPlugin : mPluginMap.values()) {
javaPlugin.onTearDown();
}
mPluginMap.clear();
return null;
public void onResult(JSDecoder result) {
}
}, ThreadMode.UI);
@Override
public void onError(Throwable t) {
}
@Override
public void onFinish() {
getDriver().asyncCall(new Callable<Object>() {
@Override
public Object call() {
for (DoricJavaPlugin javaPlugin : mPluginMap.values()) {
javaPlugin.onTearDown();
}
mPluginMap.clear();
return null;
}
}, ThreadMode.UI);
}
});
DoricContextManager.getInstance().destroyContext(this);
}

View File

@@ -57,7 +57,6 @@ public class DoricContextManager {
}
AsyncResult<Boolean> destroyContext(final DoricContext context) {
doricContextMap.remove(context.getContextId());
final AsyncResult<Boolean> result = new AsyncResult<>();
context.getDriver().destroyContext(context.getContextId()).setCallback(new AsyncResult.Callback<Boolean>() {
@Override
@@ -72,6 +71,7 @@ public class DoricContextManager {
@Override
public void onFinish() {
doricContextMap.remove(context.getContextId());
}
});
return result;

View File

@@ -17,7 +17,6 @@ package pub.doric.shader;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Matrix;