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

List:       kde-commits
Subject:    kdenetwork/librss
From:       Frerich Raabe <raabe () kde ! org>
Date:       2003-10-18 7:28:46
[Download RAW message or body]

CVS commit by raabe: 

- Fix memleak, and document that if you plan to store the list of articles
  as returned by Document::articles() somewhere, you need to create a copy of
  each article in the list. Simply copying the list will just copy the pointers,
  and thus be a major source of bugs as soon as the Document which owns the
  articles deletes them.
CCMAIL:mcamen@mcamen.de


  M +3 -1      document.cpp   1.12
  M +4 -0      document.h   1.8


--- kdenetwork/librss/document.h  #1.7:1.8
@@ -146,4 +146,8 @@ namespace RSS
                          * DTD requires that there is at least one article defined, so a
                          * null pointer indicates an invalid RSS file!
+                         * Please note that the articles contained in this list are owned
+                         * by the Document object, and thus get deleted when the Document
+                         * gets destructed. If you need to keep a list of articles around,
+                         * you need to create deep copies of the articles yourself!
                          * @see Article
                          */

--- kdenetwork/librss/document.cpp  #1.11:1.12
@@ -29,5 +29,7 @@ struct Document::Private : public Shared
 {
         Private() : version(v0_90), image(NULL), textInput(NULL), language(en)
-                { }
+        {
+                articles.setAutoDelete(true);
+        }
 
         ~Private()


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

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