]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkBlackBox.cxx
Nasty bug fix !
[bbtk.git] / kernel / src / bbtkBlackBox.cxx
index c21285cd6b136b7e4a7a96aaf92675ed61b561fd..859430f349098c23951b9cd75b3d9e4c245ad42f 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:12 $
-  Version:   $Revision: 1.25 $
+  Date:      $Date: 2008/11/12 15:42:52 $
+  Version:   $Revision: 1.26 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -50,7 +50,7 @@ namespace bbtk
 
   static bool bbmgSomeBoxExecuting = false;
   static bool bbmgFreezeExecution = false;
-  static std::set<BlackBox::Pointer> bbmgExecutionList;
+  static std::set<BlackBox::WeakPointer> bbmgExecutionList;
 
   //=========================================================================
   BlackBox::Deleter::Deleter()
@@ -1135,14 +1135,24 @@ namespace bbtk
                         "=> BlackBox::bbGlobalProcessExecutionList()"
                         <<std::endl);     
      
-     std::set<BlackBox::Pointer>::iterator i;
+     std::set<BlackBox::WeakPointer>::iterator i;
      for (i=bbmgExecutionList.begin();
          i!=bbmgExecutionList.end();
          ++i)
        {
-        bbtkDebugMessage("process",4,
-                         " -> Executing "<<(*i)->bbGetFullName()<<std::endl);
-        (*i)->bbExecute(true);
+        {
+          if ((*i).lock())
+            {
+              bbtkDebugMessage("process",4,
+                               " -> Executing "<<
+                               (*i).lock()->bbGetFullName()<<std::endl);
+              (*i).lock()->bbExecute(true);
+            }
+          else 
+            {
+              bbtkGlobalError("Strange error in BlackBox::bbGlobalProcessExecutionList() : Weak bb pointer in bbmgExecutionList is no more valid...");
+            }
+        }
        }
      
      bbmgExecutionList.clear();