[bt-devel] Fwd: patch for memory leaks

Martin Gruner mg.pub at gmx.net
Wed Nov 11 00:22:34 MST 2009


----------  Weitergeleitete Nachricht  ----------

Betreff: patch for memory leaks
Datum: Mittwoch, 11. November 2009
Von: Kang Sun <kbs at digizip.com>
An: Martin Gruner <mg.pub at gmx.net>

I've attached diffs for fixing memory leaks.  I'm not sure if the file 
is patch compatible since I created it from kdesvn.

kbs

* Martin Gruner <mg.pub at gmx.net> wrote [090829 06:06]:
> Hi Kang,
> 
> I included your patch for the compiler fixes into 2.2, thanks for that!
> 
> For all other points I'd ask you to use bt-devel at crosswire.org and/or our 
> trackers on sourceforge, otherwise they will get lost. Please enter the 
issues 
> into the bug and feature request trackers, as you already did with other 
> points, I believe.
> 
> God bless,
> 
> mg

-------------------------------------------------------------
-------------- next part --------------
Index: bibletime/src/backend/rendering/cbookdisplay.cpp
===================================================================
--- bibletime/src/backend/rendering/cbookdisplay.cpp (revision 1767)
+++ bibletime/src/backend/rendering/cbookdisplay.cpp (working copy)
@@ -45,6 +45,8 @@
 
         const QString renderedText = render.renderKeyTree(tree);
         key->setOffset( offset );
+
+              qDeleteAll(tree);      // Dispose of the heap allocated objects pointed to in tree.
         return renderedText;
     };
 
@@ -74,6 +76,7 @@
 
         const QString renderedText = render.renderKeyTree(tree);
         key->setOffset( offset );
+              qDeleteAll(tree);      // Dispose of the heap allocated objects pointed to in tree.
         return renderedText;
     };
 
@@ -90,6 +93,7 @@
 
             const QString renderedText = render.renderKeyTree(tree);
             key->setOffset( offset );
+                     qDeleteAll(tree);      // Dispose of the heap allocated objects pointed to in tree.
             return renderedText;
         };
     };
@@ -108,6 +112,7 @@
 
     key->setOffset( offset ); //restore key
 
+       qDeleteAll(tree);      // Dispose of the heap allocated objects pointed to in tree.
     return renderedText;
 }
 
Index: bibletime/src/backend/rendering/ctextrendering.cpp
===================================================================
--- bibletime/src/backend/rendering/ctextrendering.cpp       (revision 1767)
+++ bibletime/src/backend/rendering/ctextrendering.cpp       (working copy)
@@ -240,8 +240,9 @@
             tree.append( new KeyTreeItem(vk_start->key(), modules, settings) );
             ok = vk_start->next(CSwordVerseKey::UseVerse);
         }
-
-        return renderKeyTree(tree);
+              const QString renderedText = renderKeyTree(tree);
+              qDeleteAll(tree);
+              return renderedText;
     }
 
     return QString::null;
@@ -251,7 +252,9 @@
     KeyTree tree;
     tree.append( new KeyTreeItem(key, moduleList, settings) );
 
-    return renderKeyTree(tree);
+       const QString renderedText = renderKeyTree(tree);
+       qDeleteAll(tree);
+       return renderedText;
 }
 
 
Index: bibletime/src/backend/rendering/cbookdisplay.h
===================================================================
--- bibletime/src/backend/rendering/cbookdisplay.h   (revision 1767)
+++ bibletime/src/backend/rendering/cbookdisplay.h   (working copy)
@@ -10,6 +10,7 @@
 #ifndef RENDERINGCBOOKDISPLAY_H
 #define RENDERINGCBOOKDISPLAY_H
 
+#include <qalgorithms.h>
 #include "backend/rendering/centrydisplay.h"
 
 #include "backend/rendering/ctextrendering.h"
Index: bibletime/src/backend/rendering/ctextrendering.h
===================================================================
--- bibletime/src/backend/rendering/ctextrendering.h (revision 1767)
+++ bibletime/src/backend/rendering/ctextrendering.h (working copy)
@@ -12,6 +12,7 @@
 
 #include <QList>
 #include <QString>
+#include <qalgorithms.h>
 
 
 class CSwordKey;


More information about the bt-devel mailing list