Browse Source

proper solution when calling removeTask with a task name

Redmond Urbino 18 years ago
parent
commit
2716bc4cda
1 changed files with 5 additions and 1 deletions
  1. 5 1
      direct/src/showbase/DirectObject.py

+ 5 - 1
direct/src/showbase/DirectObject.py

@@ -63,7 +63,11 @@ class DirectObject:
     
     def removeTask(self, taskOrName):
         if type(taskOrName) == type(''):
-            taskMgr.remove(taskOrName)
+            # we must use a copy, since task.remove will modify self._taskList
+            taskListValues = self._taskList.values()
+            for task in taskListValues:
+                if task.name == taskOrName:
+                    task.remove()            
         else:
             taskOrName.remove()