mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix error setting breakpoints. See #308
This commit is contained in:
parent
a24d628603
commit
2ae6c872db
|
@ -322,6 +322,20 @@ public class ChromeRDPDebugger implements JavaScriptDebugger, ChromeRDPExchangeC
|
|||
}
|
||||
breakpointLocationMap.remove(breakpoint.getLocation());
|
||||
breakpoints.remove(breakpoint);
|
||||
|
||||
if (breakpoint.chromeId == null) {
|
||||
synchronized (breakpoint.updateMonitor) {
|
||||
while (breakpoint.updating.get()) {
|
||||
try {
|
||||
breakpoint.updateMonitor.wait();
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (breakpoint.chromeId != null) {
|
||||
breakpointsByChromeId.remove(breakpoint.chromeId);
|
||||
if (logger.isInfoEnabled()) {
|
||||
|
@ -371,10 +385,15 @@ public class ChromeRDPDebugger implements JavaScriptDebugger, ChromeRDPExchangeC
|
|||
}
|
||||
breakpoint.chromeId = null;
|
||||
}
|
||||
synchronized (breakpoint.updateMonitor) {
|
||||
breakpoint.updating.set(false);
|
||||
breakpoint.updateMonitor.notifyAll();
|
||||
}
|
||||
for (JavaScriptDebuggerListener listener : getListeners()) {
|
||||
listener.breakpointChanged(breakpoint);
|
||||
}
|
||||
});
|
||||
breakpoint.updating.set(true);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.teavm.chromerdp;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.teavm.debugging.javascript.JavaScriptBreakpoint;
|
||||
import org.teavm.debugging.javascript.JavaScriptLocation;
|
||||
|
@ -24,6 +25,8 @@ public class RDPBreakpoint implements JavaScriptBreakpoint {
|
|||
ChromeRDPDebugger debugger;
|
||||
private JavaScriptLocation location;
|
||||
AtomicInteger referenceCount = new AtomicInteger();
|
||||
final Object updateMonitor = new Object();
|
||||
AtomicBoolean updating = new AtomicBoolean(true);
|
||||
|
||||
RDPBreakpoint(ChromeRDPDebugger debugger, JavaScriptLocation location) {
|
||||
this.debugger = debugger;
|
||||
|
|
Loading…
Reference in New Issue
Block a user