diff --git a/Android/doric/src/main/java/pub/doric/DoricContext.java b/Android/doric/src/main/java/pub/doric/DoricContext.java index b5430f20..a60413fb 100644 --- a/Android/doric/src/main/java/pub/doric/DoricContext.java +++ b/Android/doric/src/main/java/pub/doric/DoricContext.java @@ -148,7 +148,7 @@ public class DoricContext { doricDebugDriver = new DoricDebugDriver(new IStatusCallback() { @Override public void start() { - isDebugging=true; + isDebugging = true; callEntity(DoricConstant.DORIC_ENTITY_INIT, initParams); callEntity(DoricConstant.DORIC_ENTITY_CREATE); } @@ -156,6 +156,7 @@ public class DoricContext { } public void stopDebug() { + doricDebugDriver.destroy(); isDebugging = false; callEntity(DoricConstant.DORIC_ENTITY_INIT, initParams); callEntity(DoricConstant.DORIC_ENTITY_CREATE); diff --git a/Android/doric/src/main/java/pub/doric/DoricDebugDriver.java b/Android/doric/src/main/java/pub/doric/DoricDebugDriver.java index ace507ff..1643c179 100644 --- a/Android/doric/src/main/java/pub/doric/DoricDebugDriver.java +++ b/Android/doric/src/main/java/pub/doric/DoricDebugDriver.java @@ -126,4 +126,9 @@ public class DoricDebugDriver implements IDoricDriver { public DoricRegistry getRegistry() { return doricJSEngine.getRegistry(); } + + public void destroy() { + doricJSEngine.teardown(); + mBridgeExecutor.shutdown(); + } } diff --git a/Android/doric/src/main/java/pub/doric/dev/DebugContextPanel.java b/Android/doric/src/main/java/pub/doric/dev/DebugContextPanel.java index 31443195..2ef2fd0b 100644 --- a/Android/doric/src/main/java/pub/doric/dev/DebugContextPanel.java +++ b/Android/doric/src/main/java/pub/doric/dev/DebugContextPanel.java @@ -69,6 +69,7 @@ public class DebugContextPanel extends DialogFragment { jsonObject.addProperty("projectHome", BuildConfig.PROJECT_HOME); jsonObject.addProperty("source", doricContext.getSource().replace(".js", ".ts")); Doric.sendDevCommand(IDevKit.Command.DEBUG, jsonObject); + dismissAllowingStateLoss(); } }); diff --git a/Android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java b/Android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java index 49f29773..2bf520bf 100644 --- a/Android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java +++ b/Android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java @@ -170,6 +170,7 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time public void teardown() { mDoricJSE.teardown(); + mTimerExtension.teardown(); } private void loadBuiltinJS(String assetName) { diff --git a/Android/doric/src/main/java/pub/doric/extension/timer/DoricTimerExtension.java b/Android/doric/src/main/java/pub/doric/extension/timer/DoricTimerExtension.java index ab27697c..7e3b1745 100644 --- a/Android/doric/src/main/java/pub/doric/extension/timer/DoricTimerExtension.java +++ b/Android/doric/src/main/java/pub/doric/extension/timer/DoricTimerExtension.java @@ -69,6 +69,10 @@ public class DoricTimerExtension implements Handler.Callback { return true; } + public void teardown() { + mTimerHandler.removeCallbacksAndMessages(null); + } + private class TimerInfo { long timerId; long time;