Fixed stupid bug-- when pup'ing, then calling destructor,
authorGengbin Zheng <gzheng@illinois.edu>
Sun, 6 Oct 2002 22:14:26 +0000 (22:14 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Sun, 6 Oct 2002 22:14:26 +0000 (22:14 +0000)
the DDT arrays would be deleted twice.

src/libs/conv-libs/ddt/ddt.C

index 63c2d3f8c720f8297b84737d7f6c72c22c2b47f3..f092f2d290448d4eb0c9e8eb0503ad9e14746221 100644 (file)
@@ -61,15 +61,8 @@ CkDDT::pup(PUP::er &p)
     if(types[i] != CkDDT_TYPE_NULL)
     {
       typeTable[i]->pupType(p, this);
-      if(p.isDeleting())
-        delete typeTable[i];
     }
   }
-  if(p.isDeleting())
-  {
-    delete[] typeTable;
-    delete[] types;
-  }
 }
 
 int  
@@ -116,6 +109,13 @@ CkDDT::freeType(int* index)
 
 CkDDT::~CkDDT()
 {
+  for(int i=0; i < max_types ; i++)
+  {
+    if(types[i] != CkDDT_TYPE_NULL)
+    {
+       delete typeTable[i];
+    }
+  }
   delete[] typeTable ;
   delete[] types;
 }