Fix restarting sketch in Debug mode when Run is pressed

Disconnect event of the old VM would arrive after the new VM was
created, closing it instantly and leaving user without a running sketch.
This commit is contained in:
Jakub Valtar
2017-01-23 03:09:51 +01:00
parent 95ebcdb825
commit d8e8619f6e

View File

@@ -533,6 +533,12 @@ public class Debugger {
* @param es Incoming set of events from VM
*/
public synchronized void vmEvent(EventSet es) {
VirtualMachine vm = vm();
if (vm != null && vm != es.virtualMachine()) {
// This is no longer VM we are interested in,
// we already cleaned up and run different VM now.
return;
}
for (Event e : es) {
log("*** VM Event: " + e);
if (e instanceof VMStartEvent) {