From 5ace610bc9a72b53a1af4d9b76cd9fcedf8737c9 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 19 Jun 2015 20:35:52 +0200 Subject: [PATCH] Try to catch race condition of opening tasks twice. --- .../javascripts/app/controllers/navigation.js.coffee | 4 ++-- .../app/lib/app_post/task_manager.js.coffee | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index 660a522b8..084e82b8f 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -131,6 +131,8 @@ class App.Navigation extends App.ControllerWidgetPermanent user: user ) + @taskbar = new App.TaskbarWidget( el: @$('.tasks') ) + # renderMenu @renderMenu() @@ -274,8 +276,6 @@ class App.Navigation extends App.ControllerWidgetPermanent el: @el ) - @taskbar = new App.TaskbarWidget( el: @$('.tasks') ) - getItems: (data) -> navbar = _.values(data.navbar) diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee index f51bebd5f..920bb559b 100644 --- a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee @@ -132,6 +132,11 @@ class _taskManagerSingleton extends Spine.Module # input validation params.key = App.Utils.htmlAttributeCleanup(params.key) + # in case an init execute arrives later but is aleady executed, ignore it + if params.init && @tasksStarted[params.key] + #console.log('IGNORE LATER INIT', params) + return + # remember started task / prevent to open task twice createNewTask = true if @tasksStarted[params.key] @@ -142,11 +147,6 @@ class _taskManagerSingleton extends Spine.Module if params.init params.params.init = true - # in case an init execute arrives later but is aleady executed, ignore it - if params.init && @workers[ params.key ] - #console.log('IGNORE LATER INIT', params) - return - # remember latest active controller if params.show @activeTaskHistory.push _.clone(params)