]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Thu, 30 Apr 2009 14:31:30 +0000 (14:31 +0000)
committerguigues <guigues>
Thu, 30 Apr 2009 14:31:30 +0000 (14:31 +0000)
kernel/src/bbtkAtomicBlackBox.h
kernel/src/bbtkAtomicBlackBoxMacros.h
kernel/src/bbtkBlackBox.cxx
kernel/src/bbtkBlackBox.h
kernel/src/bbtkInterpreter.cxx
kernel/src/bbtkItkBlackBoxMacros.h
kernel/src/bbtkObject.cxx
kernel/src/bbtkObject.h
kernel/src/bbtkVtkBlackBoxMacros.h
packages/vtk/src/bbvtkImagePlanes.cxx

index 3be67510c8afd8f5a0b24e96c4cae4c913b44a45..8348ea410581c314db0b4a99b428b0d86bfef2f1 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkAtomicBlackBox.h,v $
   Language:  C++
-  Date:      $Date: 2008/12/11 09:50:34 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2009/04/30 14:31:30 $
+  Version:   $Revision: 1.9 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -147,6 +147,15 @@ namespace bbtk
     virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer) {}
     /// User callback called in the box destructor
     virtual void bbUserDestructor() {}
+    //==================================================================    
+
+    //==================================================================
+    /// System callback which calls bbUserConstructor for all its ancestors 
+    /// and the box itself
+    virtual void bbConstructor() {}
+    /// System callback which calls bbUserDestructor for all its ancestors 
+    /// and the box itself
+    virtual void bbDestructor() {}
     //==================================================================    
 
      //==================================================================
index 8d8df46887321cba621ccdd968e863dbad63de29..9bc56ad02c3d59b53d957fe7adcfc962f93700b1 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkAtomicBlackBoxMacros.h,v $
   Language:  C++
-  Date:      $Date: 2009/04/08 07:56:11 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2009/04/30 14:31:30 $
+  Version:   $Revision: 1.15 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -41,7 +41,7 @@
 /// Declares the standard interface of a AtomicBlackBox 
 /// (ctor, New, descriptor related methods)
 #define BBTK_BLACK_BOX_INTERFACE_INTERNAL_WITHOUT_NEW(CLASS,PARENT)    \
-  BBTK_OBJECT_MINIMAL_INTERFACE;                               \
+  BBTK_OBJECT_MINIMAL_INTERFACE;                                       \
   private:                                                             \
   protected:                                                           \
   CLASS(const std::string& name, bool allocate_connectors = true);     \
   { return std::string(#CLASS)+std::string(" '")                       \
       +bbGetNameWithParent()+std::string("'"); }                       \
   virtual void bbLockDescriptor();                                     \
+  virtual void bbConstructor() {                                       \
+    PARENT::bbConstructor();                                           \
+    CLASS::bbUserConstructor();                                                \
+  }                                                                    \
+  virtual void bbDestructor() {                                                \
+    PARENT::bbDestructor();                                            \
+    CLASS::bbUserDestructor();                                         \
+  }                                                                    \
   private:                                                             \
   CLASS() : PARENT("") {}                                              \
   CLASS(const CLASS&) : PARENT("") {}                                  
-
+  
 //============================================================================
 
 //============================================================================
     return p;                                                          \
   }                                                                    \
   virtual void bbLockDescriptor();                                     \
+  virtual void bbConstructor() {                                       \
+    PARENT::bbConstructor();                                           \
+    CLASS::bbUserConstructor();                                                \
+  }                                                                    \
+  virtual void bbDestructor() {                                                \
+    PARENT::bbDestructor();                                            \
+    CLASS::bbUserDestructor();                                         \
+  }                                                                    \
   private:                                                             \
   CLASS() : PARENT("") {}                                              \
   CLASS(const CLASS&) : PARENT("") {}                                  
     : PARENT(name,false)                                               \
   {                                                                    \
     BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,allocate_connectors);       \
-    CLASS::bbUserConstructor();                                                \
+    /*CLASS::bbUserConstructor();      */                              \
     BBTK_END_BLACK_BOX_CONSTRUCTOR(CLASS);                             \
   }                                                                    \
   CLASS::CLASS(CLASS& from,                                            \
     : PARENT(from,name,false)                                          \
   {                                                                    \
     BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
-    CLASS::bbUserCopyConstructor(from.GetThisPointer<bbtk::BlackBox>()); \
+    /*CLASS::bbUserCopyConstructor(from.GetThisPointer<bbtk::BlackBox>());*/ \
     BBTK_END_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from);                   \
   }                                                                    \
   CLASS::~CLASS()                                                      \
   {                                                                    \
     BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS);                            \
-    CLASS::bbUserDestructor();                                         \
+    /*CLASS::bbUserDestructor();*/                                     \
     BBTK_END_BLACK_BOX_DESTRUCTOR(CLASS);                              \
   }                                                                    \
   void CLASS::bbLockDescriptor()                                       \
       {                                                                        \
        return Instance();                                              \
       }                                                                        \
-    static bbtk::AtomicBlackBoxDescriptor::Pointer Instance()                  \
+    static bbtk::AtomicBlackBoxDescriptor::Pointer Instance()          \
       {                                                                        \
-       static bbtk::AtomicBlackBoxDescriptor::WeakPointer i;                   \
-       bbtk::AtomicBlackBoxDescriptor::Pointer j;                              \
+       static bbtk::AtomicBlackBoxDescriptor::WeakPointer i;           \
+       bbtk::AtomicBlackBoxDescriptor::Pointer j;                      \
        if (!i.lock()) { j = Self::New(); i = j; }                      \
        return i.lock();                                                \
       }                                                                        \
     : PARENT(name,false)                                               \
   {                                                                    \
     BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc);                     \
-    CLASS<T>::bbUserConstructor();                                     \
+    /*CLASS<T>::bbUserConstructor();*/                                 \
     BBTK_END_BLACK_BOX_CONSTRUCTOR(CLASS);                             \
   }                                                                    \
   template <class T>                                                   \
     : PARENT(from,name,false)                                          \
   {                                                                    \
     BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
-    CLASS<T>::bbUserCopyConstructor(from.GetThisPointer<bbtk::BlackBox>()); \
+    /*CLASS<T>::bbUserCopyConstructor(from.GetThisPointer<bbtk::BlackBox>());*/ \
     BBTK_END_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from);                   \
   }                                                                    \
   template <class T>                                                   \
   CLASS<T>::~CLASS()                                                   \
   {                                                                    \
     BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS);                            \
-    CLASS<T>::bbUserDestructor();                                      \
+    /*CLASS<T>::bbUserDestructor();*/                                  \
     BBTK_END_BLACK_BOX_DESTRUCTOR(CLASS);                              \
   }                                                                    \
   template <class T>                                                   \
     : PARENT(name,false)                                               \
   {                                                                    \
     BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc);                     \
-    CLASS<T1,T2>::bbUserConstructor();                                 \
+    /*CLASS<T1,T2>::bbUserConstructor();*/                             \
     BBTK_END_BLACK_BOX_CONSTRUCTOR(CLASS);                             \
   }                                                                    \
   template <class T1, class T2>                                                \
     : PARENT(from,name,false)                                          \
   {                                                                    \
     BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
-    CLASS<T1,T2>::bbUserCopyConstructor(from.GetThisPointer<bbtk::BlackBox>());        \
+    /*CLASS<T1,T2>::bbUserCopyConstructor(from.GetThisPointer<bbtk::BlackBox>());*/ \
     BBTK_END_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from);                   \
   }                                                                    \
   template <class T1, class T2>                                                \
   CLASS<T1,T2>::~CLASS()                                               \
   {                                                                    \
     BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS);                            \
-    CLASS<T1,T2>::bbUserDestructor();                                  \
+    /*CLASS<T1,T2>::bbUserDestructor();*/                              \
     BBTK_END_BLACK_BOX_DESTRUCTOR(CLASS);                              \
   }                                                                    \
   template <class T1, class T2>                                                \
 //============================================================================
 
 
-/*
-//============================================================================
-/// Template AtomicBlackBox std implementation of ctor and dtor
-#define BBTK_BLACK_BOX_TEMPLATE2_WITH_TYPES_IMPLEMENTATION(CLASS,PARENT,TYPE1,TYPE2) \
-  template <TYPE1 T1, TYPE2 T2>                                                \
-  CLASS<T1,T2>::CLASS(const std::string& name, bool alloc)             \
-    : PARENT(name,false)                                               \
-  {                                                                    \
-    BBTK_BEGIN_BLACK_BOX_CONSTRUCTOR(CLASS,alloc);                     \
-    this->bbUserConstructor();                                         \
-    BBTK_END_BLACK_BOX_CONSTRUCTOR;                                    \
-  }                                                                    \
-  template <TYPE1 T1, TYPE2 T2>                                                \
-  CLASS<T1,T2>::CLASS(CLASS<T1,T2>& from,                              \
-                     const std::string& name, bool allocate_connectors) \
-    : PARENT(from,name,false)                                          \
-  {                                                                    \
-    BBTK_BEGIN_BLACK_BOX_COPY_CONSTRUCTOR(CLASS,from,allocate_connectors); \
-    this->bbUserCopyConstructor();                                     \
-    BBTK_END_BLACK_BOX_CONSTRUCTOR;                                    \
-  }                                                                    \
-  template <TYPE1 T1, TYPE2 T2>                                                \
-  CLASS<T1,T2>::~CLASS()                                               \
-  {                                                                    \
-    BBTK_BEGIN_BLACK_BOX_DESTRUCTOR(CLASS);                            \
-    this->bbUserDestructor();                                          \
-    BBTK_END_BLACK_BOX_DESTRUCTOR;                                     \
-  }                                                                    \
-  template <class T1, class T2>                                                \
-  void CLASS<T1,T2>::bbLockDescriptor()                                        \
-  {                                                                    \
-    bbmDescriptorPointer = CLASS ## Descriptor<T1,T2>::Instance();     \
-  }
-//============================================================================
-
-*/
-
-
-
-
 
 
 
index 9eb65e2c30f97e768a500843947362d000f37475..4aa8d0160fcb3d3b2b867d73b273d3bff7cb9f65 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/04/08 07:56:11 $
-  Version:   $Revision: 1.42 $
+  Date:      $Date: 2009/04/30 14:31:31 $
+  Version:   $Revision: 1.43 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -62,7 +62,7 @@ namespace bbtk
   //=========================================================================
   
   //=========================================================================
-  void BlackBox::Deleter::Delete(Object* p)
+  int BlackBox::Deleter::Delete(Object* p)
   {
     BlackBox* b = dynamic_cast<BlackBox*>(p);
     if (!b)
@@ -78,7 +78,7 @@ namespace bbtk
     BlackBoxDescriptor::WeakPointer desc = b->bbGetDescriptor();
     bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : deleting black box"<<std::endl);
     
-    b->bbDelete();
+    int refs = b->bbDelete();
 
     bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : releasing descriptor"<<std::endl);
     
@@ -99,6 +99,7 @@ namespace bbtk
        bbtkDebugMessage("object",2,"##> BlackBox::Deleter(\""<<name<<"\") : descriptor expired : nothing to do (was not held by a package or the box is a complex black box prototype)"<<std::endl);
       }
     bbtkDebugMessage("object",2,"<## BlackBox::Deleter(\""<<name<<"\")"<<std::endl);
+    return refs;
   }
   //=========================================================================
 
@@ -106,6 +107,7 @@ namespace bbtk
   BlackBox::BlackBox(const std::string &name) 
     : 
     //    bbmStatus(MODIFIED), 
+    bbmConstructed(false),
     bbmExecuting(false),
     bbmName(name),
     bbmBoxProcessMode("Pipeline"),
@@ -127,11 +129,12 @@ namespace bbtk
   BlackBox::BlackBox(BlackBox& from, const std::string &name) 
     :
     //    bbmStatus(from.bbmStatus), 
-      bbmExecuting(false),
-      bbmName(name), 
-      bbmBoxProcessMode(from.bbmBoxProcessMode),
-      bbmParent()
-
+    bbmConstructed(false),
+    bbmExecuting(false),
+    bbmName(name), 
+    bbmBoxProcessMode(from.bbmBoxProcessMode),
+    bbmParent()
+    
   {
     bbtkDebugMessage("object",4,"==> BlackBox::BlackBox("
                     <<from.bbGetFullName()<<",\""
@@ -767,6 +770,14 @@ namespace bbtk
                         " -> already executing : abort"<<std::endl);
        return; 
       }
+    
+    // If not constructed do it 
+    if (!bbmConstructed) 
+      {
+       this->bbConstructor();
+       bbmConstructed = true;
+      }
+
 
     bbSetExecuting(true);
     bool wasExecuting = bbGlobalGetSomeBoxExecuting();
index 6e44fde62c7b12b5f8e24f9564a7ac706c70b513..d25fc88c01d2dc505dce8162df5803b6ae031095 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.h,v $
   Language:  C++
-  Date:      $Date: 2009/04/08 07:56:11 $
-  Version:   $Revision: 1.23 $
+  Date:      $Date: 2009/04/30 14:31:31 $
+  Version:   $Revision: 1.24 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -118,7 +118,15 @@ namespace bbtk
 
 
  
-  
+    //==================================================================
+    /// System callback which calls bbUserConstructor for all its ancestors 
+    /// and the box itself
+    virtual void bbConstructor() {}
+    /// System callback which calls bbUserDestructor for all its ancestors 
+    /// and the box itself
+    virtual void bbDestructor() {}
+    //==================================================================    
 
 
     /// Returns true iff the BlackBox has an input of name label
@@ -470,8 +478,8 @@ namespace bbtk
     /// 2) Releases the box descriptor
     struct BBTK_EXPORT Deleter : public Object::Deleter
     { 
-               Deleter(); 
-      void Delete(Object* p);
+      Deleter(); 
+      int Delete(Object* p);
     };
     //==================================================================
 
@@ -484,7 +492,7 @@ namespace bbtk
     //==================================================================
 
     //==================================================================
-    virtual void bbDelete() { delete this; }
+    virtual int bbDelete() { delete this; return 0; }
     //==================================================================
 
 
@@ -494,6 +502,8 @@ namespace bbtk
  
     //==================================================================
     // ATTRIBUTES
+    /// Is the box "constructed" ? (initialized)
+    bool bbmConstructed;
     /// Is the box executing ?
     bool bbmExecuting;
     /// The name of the black-box
index ef8be1b5f84ebb664c0fd51a7c10f2cfb0ba5a32..e71ff53d0e0a2f0f3f135f8dbed23a87afae0d78 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/04/08 07:56:11 $
-  Version:   $Revision: 1.83 $
+  Date:      $Date: 2009/04/30 14:31:31 $
+  Version:   $Revision: 1.84 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -219,7 +219,7 @@ namespace bbtk
     info.argmin = 1;
     info.argmax = 1;
     info.code = cKind;
-    info.syntax = "kind <ADAPTOR|DEFAULT_ADAPTOR|WIDGET_ADAPTOR|DEFAULT_WIDGET_ADAPTOR>";
+    info.syntax = "kind <ADAPTOR|DEFAULT_ADAPTOR|GUI|DEFAULT_GUI>";
     info.help = "Sets the kind of the currently defined complex black box";
     mCommandDict[info.keyword] = info;
 
index 7f10fef9cf29ff57124d146b5dddd082dea28e23..ddcb7b9762202ae329461c6d81c371176fe39f2a 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkItkBlackBoxMacros.h,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:13 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2009/04/30 14:31:31 $
+  Version:   $Revision: 1.5 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
 
 //===========================================================================
 #define BBTK_ITK_DELETE()                                              \
-  void bbDelete() {                                                    \
+  int bbDelete() {                                                     \
+    int refs = itkParent::GetReferenceCount()-1;                       \
     itkParent::UnRegister();                                           \
+    return refs;                                                       \
   }
 //===========================================================================
 
index 7f7bc2ecdeadd5d8c11d731ce21ed3239c028c2f..52fa18075fa5276dbb27e44d722b3bf09bf7e48c 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkObject.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:13 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2009/04/30 14:31:31 $
+  Version:   $Revision: 1.11 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -140,13 +140,13 @@ namespace bbtk
       {
        std::cout<<"* Note : "<<u
                 <<" object in list has 0 ref count, "
-                <<"i.e. destroyed without removing itself from the living objects list ! (this is just an implementation error not a memory leak)"<<std::endl;
+                <<"i.e. are no more accessible by bbtk but did not properly destroyed because another ref counting system is holding them !"<<std::endl;
       }
     else if (u>1)
       {
        std::cout<<"* Note : "<<u
                 <<" objects in list have 0 ref count, "
-                <<"i.e. destroyed without removing themselves from the living objects list ! (this is just an implementation error not a memory leak)"<<std::endl;
+                <<"i.e. are no more accessible by bbtk but did not properly destroyed because another ref counting system is holding them !"<<std::endl;
       }
     std::cout
       << "============ EO Living bbtk::Object pointers ========="<<std::endl;
@@ -199,10 +199,19 @@ namespace bbtk
     bbtkDebugMessage("object",1,"##> Object::Deleter : deleting \""
                     <<name<<"\" ["<<adr<<"]"<<std::endl);
 #endif
-    Object::RemoveFromObjectList(mPointer);
-    this->Delete(p);
-    bbtkDebugMessage("object",2,"<## Object::Deleter : \""<<name<<"\" ["
-                    <<adr<<"] deleted"<<std::endl);
+    int remaining = this->Delete(p);
+    if (remaining == 0)
+      {
+       Object::RemoveFromObjectList(mPointer);
+       bbtkDebugMessage("object",2,"<## Object::Deleter : \""<<name<<"\" ["
+                        <<adr<<"] deleted"<<std::endl);
+      }
+    else
+      {
+       bbtkWarning("##### Object::Deleter \""<<name<<"\" failed !!! "
+                   << remaining << " reference(s) still around..."
+                   <<std::endl); 
+      }
   }
   //=======================================================================
 
index a2bbc8f22365ead4cb9af1c6ea8c4e4d31e127bf..2ba72ffa059c47cb2b22bf24081bbee44e316da9 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkObject.h,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:13 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2009/04/30 14:31:31 $
+  Version:   $Revision: 1.8 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -80,7 +80,7 @@ namespace bbtk
       Deleter() : mPointer() {}
       virtual ~Deleter() {}
       virtual void operator() (Object* p); 
-      virtual void Delete(Object* p) { delete p; }
+      virtual int Delete(Object* p) { delete p; return 0; }
       WeakPointer mPointer;
     };
 
@@ -132,7 +132,6 @@ namespace bbtk
       return p;                                                        
     }                                                                  
      
-
   private:
     typedef std::set<boost::weak_ptr<Object> > ObjectListType;
     static ObjectListType mgObjectList;
index ce87d7e37c2ccc56472c16322767a65d7283360a..21816d3f9de43f510c60fb6f4bf19a5236c98786 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkVtkBlackBoxMacros.h,v $
   Language:  C++
-  Date:      $Date: 2009/02/27 11:20:25 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2009/04/30 14:31:31 $
+  Version:   $Revision: 1.9 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
 
 //===========================================================================
 #define BBTK_VTK_DELETE()                                              \
-  void bbDelete() {                                                    \
+  int bbDelete() {                                                     \
     for (int i=0; i<vtkParent::GetNumberOfInputPorts();++i)            \
       vtkParent::SetInput(i,0);                                                \
     bbGetOutputOut()->SetSource(NULL);                                 \
-    /*std::cout << "VTK : bbDelete() "<<std::endl;*/                   \
-    /*std::cout << "Use count = "<<GetUseCount()<<std::endl;*/         \
-    /*std::cout << "VTK count = "<<GetReferenceCount()<<std::endl;*/   \
-    /*    vtkParent::SetReferenceCount(1); GetUseCount());*/           \
-    /*delete this;     */                                              \
+    int refs = GetReferenceCount()-1;                                  \
     vtkParent::Delete();                                               \
+    return refs;                                                       \
   }
 
 //    bbmDescriptorPointer.reset();            
index a6eef68aa2e34596b3cdf12f4a973400d35beb97..f716663b9cb34c1076cdbfc707ad8171043410d2 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbvtkImagePlanes.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/04/17 09:24:02 $
-  Version:   $Revision: 1.22 $
+  Date:      $Date: 2009/04/30 14:31:33 $
+  Version:   $Revision: 1.23 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -133,7 +133,7 @@ namespace bbvtk
  };
   //================================================================
 
-  //vtkCxxRevisionMacro(ImagePlanes::VtkCallbackType, "$Revision: 1.22 $");
+  //vtkCxxRevisionMacro(ImagePlanes::VtkCallbackType, "$Revision: 1.23 $");
 
   //================================================================
 
@@ -224,24 +224,24 @@ namespace bbvtk
     if (bbGetOutputPlaneX()) 
       {
        bbGetOutputPlaneX()->SetInput(NULL);
-       bbGetOutputPlaneX()->RemoveObserver(mVtkCallback);
+       //      if (mVtkCallback) bbGetOutputPlaneX()->RemoveObserver(mVtkCallback);
        bbGetOutputPlaneX()->Delete();
       }
     if (bbGetOutputPlaneY()) 
       {
        bbGetOutputPlaneY()->SetInput(NULL);
-       bbGetOutputPlaneY()->RemoveObserver(mVtkCallback);
+       //      if (mVtkCallback) bbGetOutputPlaneY()->RemoveObserver(mVtkCallback);
        bbGetOutputPlaneY()->Delete();
       }
     if (bbGetOutputPlaneZ()) 
       {
        bbGetOutputPlaneZ()->SetInput(NULL);
-       bbGetOutputPlaneZ()->RemoveObserver(mVtkCallback);
+       //      if (mVtkCallback) bbGetOutputPlaneZ()->RemoveObserver(mVtkCallback);
        bbGetOutputPlaneZ()->Delete();
       }
     if (mVtkCallback) 
       {
-       mVtkCallback->Delete();
+       //      mVtkCallback->Delete();
       }
   }