From 9cf79a6b21afe7e7a047e2e2ff44c7b66fb16a2b Mon Sep 17 00:00:00 2001 From: fros4943 Date: Thu, 2 Oct 2008 21:23:03 +0000 Subject: [PATCH] kill potentially unfinished compilation process when dialog is closed --- .../mspsim/src/se/sics/cooja/mspmote/MspMoteType.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java index b2f4a42b1..a895a821d 100644 --- a/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java +++ b/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMoteType.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: MspMoteType.java,v 1.11 2008/09/20 09:16:28 fros4943 Exp $ + * $Id: MspMoteType.java,v 1.12 2008/10/02 21:23:03 fros4943 Exp $ */ package se.sics.cooja.mspmote; @@ -351,6 +351,8 @@ public abstract class MspMoteType implements MoteType { private String customizedCompileCommand = null; + private Process compileProcess; + static enum DialogState { NO_SOURCE, SELECTED_SOURCE, IS_COMPILING, COMPILED_SOURCE } @@ -458,7 +460,7 @@ public abstract class MspMoteType implements MoteType { try { String[] cmd = command.split(" "); - final Process compileProcess = Runtime.getRuntime().exec(cmd, null, + compileProcess = Runtime.getRuntime().exec(cmd, null, parentDirectory); final BufferedReader processNormal = new BufferedReader( @@ -606,6 +608,9 @@ public abstract class MspMoteType implements MoteType { sourceFile = null; ELFFile = null; + if (compileProcess != null) { + compileProcess.destroy(); + } myDialog.dispose(); } });