From a5d82813f1519197ffb5471be75cd915564ffacb Mon Sep 17 00:00:00 2001 From: Ben Gruver Date: Sun, 24 Jul 2016 15:12:24 -0700 Subject: [PATCH] Call ContextUtil.getSourcePosition on the debugger manager thread --- .../debugging/SmaliSteppingCommandProvider.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliSteppingCommandProvider.java b/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliSteppingCommandProvider.java index 4be1e7f0..8c756810 100644 --- a/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliSteppingCommandProvider.java +++ b/smalidea/src/main/java/org/jf/smalidea/debugging/SmaliSteppingCommandProvider.java @@ -35,6 +35,7 @@ import com.intellij.debugger.SourcePosition; import com.intellij.debugger.engine.ContextUtil; import com.intellij.debugger.engine.DebugProcessImpl.ResumeCommand; import com.intellij.debugger.engine.SuspendContextImpl; +import com.intellij.debugger.engine.events.DebuggerCommandImpl; import com.intellij.debugger.impl.JvmSteppingCommandProvider; import com.sun.jdi.request.StepRequest; import org.jetbrains.annotations.NotNull; @@ -44,8 +45,16 @@ public class SmaliSteppingCommandProvider extends JvmSteppingCommandProvider { @Override public ResumeCommand getStepOverCommand(@NotNull final SuspendContextImpl suspendContext, boolean ignoreBreakpoints, int stepSize) { - SourcePosition locationPosition = ContextUtil.getSourcePosition(suspendContext); - if (locationPosition != null && locationPosition.getFile().getLanguage() == SmaliLanguage.INSTANCE) { + + final SourcePosition[] location = new SourcePosition[1]; + + suspendContext.getDebugProcess().getManagerThread().invokeAndWait(new DebuggerCommandImpl() { + @Override protected void action() throws Exception { + location[0] = ContextUtil.getSourcePosition(suspendContext); + } + }) ; + + if (location[0] != null && location[0].getFile().getLanguage() == SmaliLanguage.INSTANCE) { return suspendContext.getDebugProcess().createStepOverCommand(suspendContext, ignoreBreakpoints, StepRequest.STEP_MIN); }