]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkObject.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkObject.cxx
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); 
+      }
   }
   //=======================================================================