fix:when onDestroy call native plugin
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user