From 07ad411bfb4653cf3897eff42d350b9587b874b0 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 20 Sep 2019 16:28:18 +0200 Subject: [PATCH] Stopping Processes correctly --- FloatingSpace/StrategyPart.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index 237449247..fb3761428 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -543,20 +543,25 @@ function newStrategyPart () { /* We will wait to the event that the task was terminated in order to call back the menu item */ let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id - systemEventHandler.listenToEvent(key, 'Task Running', undefined, key, undefined, onTaskTerminated) + systemEventHandler.listenToEvent(key, 'Running', undefined, key, undefined, onTaskTerminated) function onTaskTerminated () { - callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE) + if (callBackFunction !== undefined) { + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE) + } } } function stop (callBackFunction) { /* We will wait to the event that the task was terminated in order to call back the menu item */ let key = thisObject.payload.node.name + '-' + thisObject.payload.node.type + '-' + thisObject.payload.node.id - let eventSubscriptionId = systemEventHandler.listenToEvent(key, 'Task Stopped', undefined, key, undefined, onTaskTerminated) + let eventSubscriptionId = systemEventHandler.listenToEvent(key, 'Stopped', undefined, key, undefined, onTaskTerminated) function onTaskTerminated () { - callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE) + if (callBackFunction !== undefined) { + callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE) + } + if (thisObject.circularProgressBar !== undefined) { thisObject.circularProgressBar.finalize() thisObject.circularProgressBar = undefined