[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kalzium/libavogadro-kalzium/src
From:       Laurent Montel <montel () kde ! org>
Date:       2008-06-19 9:14:41
Message-ID: 1213866881.735382.8958.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 822121 by mlaurent:

Fix mem leak


 M  +1 -0      color.cpp  
 M  +1 -1      povpainter.cpp  
 M  +13 -8     primitiveitemmodel.cpp  
 M  +1 -0      primitiveitemmodel.h  


--- trunk/KDE/kdeedu/kalzium/libavogadro-kalzium/src/color.cpp #822120:822121
@@ -43,6 +43,7 @@
   }
 
   Color::~Color() {
+      //delete d;
   }
 
   Color::Color( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ):
--- trunk/KDE/kdeedu/kalzium/libavogadro-kalzium/src/povpainter.cpp #822120:822121
@@ -62,7 +62,7 @@
 
   POVPainter::~POVPainter()
   {
-
+    delete d;
   }
 
   void POVPainter::setColor (const Color *color)
--- trunk/KDE/kdeedu/kalzium/libavogadro-kalzium/src/primitiveitemmodel.cpp #822120:822121
@@ -45,7 +45,7 @@
 
       /*
        * for Molecules we have to cache additions / subtractions
-       * because when we get the signal we haven't actually added 
+       * because when we get the signal we haven't actually added
        * the atom to the molecule, rather it's been created but not
        * yet added.
        */
@@ -93,6 +93,11 @@
         this, SLOT(removePrimitive(Primitive *)));
   }
 
+  void PrimitiveItemModel::~PrimitiveItemModel()
+  {
+      delete d;
+  }
+
   void PrimitiveItemModel::addPrimitive(Primitive *primitive)
   {
     int parentRow = d->rowTypeMap.key(primitive->type());
@@ -100,14 +105,14 @@
     if(parentRow < d->size.size())
     {
       emit layoutAboutToBeChanged(); // we need to tell the view that the data is going to change
-      
+
       int last = d->size[parentRow]++;
       beginInsertRows(createIndex(parentRow, 0, 0), last, last);
       if(d->molecule) {
         d->moleculeCache[parentRow].append(primitive);
       }
       endInsertRows();
-      
+
       emit layoutChanged(); // we need to tell the view to refresh
     }
   }
@@ -133,7 +138,7 @@
       if (row < 0)
         return;
       emit layoutAboutToBeChanged(); // we need to tell the view that the data is going to change
-      
+
       beginRemoveRows(createIndex(parentRow, 0, 0), row, row);
       if(d->molecule)
       {
@@ -141,7 +146,7 @@
       }
       d->size[parentRow]--;
       endRemoveRows();
-      
+
       emit layoutChanged(); // we need to tell the view to refresh
     }
   }
@@ -153,7 +158,7 @@
       int parentRow = d->rowTypeMap.key(primitive->type());
       return d->moleculeCache[parentRow].indexOf(primitive);
     }
-    else if (d->engine) 
+    else if (d->engine)
     {
       QList<Primitive *> subList = d->engine->primitives().subList(primitive->type());
       return subList.indexOf(primitive);
@@ -176,11 +181,11 @@
         d->size[row] = newsize;
 
         emit layoutAboutToBeChanged(); // we need to tell the view that the data is going to change
-        
+
         beginRemoveRows(createIndex(row,0,0), newsize, oldsize-1);
         // this is a minor hack to simplify things although it doesn't currently update the view
         endRemoveRows();
-        
+
         emit layoutChanged();
       }
       else if(newsize > oldsize)
--- trunk/KDE/kdeedu/kalzium/libavogadro-kalzium/src/primitiveitemmodel.h #822120:822121
@@ -46,6 +46,7 @@
     public:
       explicit PrimitiveItemModel( Engine *engine, QObject *parent = 0 );
       explicit PrimitiveItemModel( Molecule *molecule, QObject *parent = 0 );
+      ~PrimitiveItemModel();
 
       QModelIndex parent( const QModelIndex & index ) const;
       int rowCount( const QModelIndex & parent = QModelIndex() ) const;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic