[poppler] qt4/src qt4/tests qt5/src qt5/tests

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Jan 19 22:44:36 UTC 2017


 qt4/src/poppler-optcontent-private.h |    2 ++
 qt4/src/poppler-optcontent.cc        |    3 +++
 qt4/tests/check_links.cpp            |    2 ++
 qt5/src/poppler-optcontent-private.h |    2 ++
 qt5/src/poppler-optcontent.cc        |    3 +++
 qt5/tests/check_links.cpp            |    2 ++
 6 files changed, 14 insertions(+)

New commits:
commit e7aad35dcba3449bc8a56de070fea7e09cb64833
Author: Hubert Figuière <hub at figuiere.net>
Date:   Tue Jan 17 23:58:00 2017 -0500

    Qt: fix memory leaks found when running tests
    
    -cleanup objects in tests to fix memory leaks.
    -optcontent was leaking the headers items
    
    Bug #99449

diff --git a/qt4/src/poppler-optcontent-private.h b/qt4/src/poppler-optcontent-private.h
index 25bae04..b5e5299 100644
--- a/qt4/src/poppler-optcontent-private.h
+++ b/qt4/src/poppler-optcontent-private.h
@@ -3,6 +3,7 @@
  * Copyright (C) 2007, Brad Hards <bradh at kde.org>
  * Copyright (C) 2008, Pino Toscano <pino at kde.org>
  * Copyright (C) 2016, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2017, Hubert Figuière <hub at figuiere.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -110,6 +111,7 @@ namespace Poppler
     OptContentModel *q;
 
     QMap<QString, OptContentItem*> m_optContentItems;
+    QList<OptContentItem*> m_headerOptContentItems;
     QList<RadioButtonGroup*> m_rbgroups;
     OptContentItem *m_rootNode;
 
diff --git a/qt4/src/poppler-optcontent.cc b/qt4/src/poppler-optcontent.cc
index 84a4d62..a5b651a 100644
--- a/qt4/src/poppler-optcontent.cc
+++ b/qt4/src/poppler-optcontent.cc
@@ -4,6 +4,7 @@
  * Copyright (C) 2008, 2014, Pino Toscano <pino at kde.org>
  * Copyright (C) 2008, Carlos Garcia Campos <carlosgc at gnome.org>
  * Copyright (C) 2015, 2016, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2017, Hubert Figuière <hub at figuiere.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -190,6 +191,7 @@ namespace Poppler
   {
     qDeleteAll( m_optContentItems );
     qDeleteAll( m_rbgroups );
+    qDeleteAll( m_headerOptContentItems );
     delete m_rootNode;
   }
 
@@ -217,6 +219,7 @@ namespace Poppler
       } else if ( orderItem.isString() ) {
 	GooString *label = orderItem.getString();
 	OptContentItem *header = new OptContentItem ( UnicodeParsedString ( label ) );
+	m_headerOptContentItems.append( header );
 	addChild( parentNode, header );
 	parentNode = header;
 	lastItem = header;
diff --git a/qt4/tests/check_links.cpp b/qt4/tests/check_links.cpp
index b5b2dee..d4e7f03 100644
--- a/qt4/tests/check_links.cpp
+++ b/qt4/tests/check_links.cpp
@@ -68,6 +68,8 @@ void TestLinks::checkDests_xr01()
     QCOMPARE( dest.destinationName(), QString::fromLatin1("section.2") );
     }
 
+    qDeleteAll(links);
+    delete page;
     delete doc;
 }
 
diff --git a/qt5/src/poppler-optcontent-private.h b/qt5/src/poppler-optcontent-private.h
index 25bae04..b5e5299 100644
--- a/qt5/src/poppler-optcontent-private.h
+++ b/qt5/src/poppler-optcontent-private.h
@@ -3,6 +3,7 @@
  * Copyright (C) 2007, Brad Hards <bradh at kde.org>
  * Copyright (C) 2008, Pino Toscano <pino at kde.org>
  * Copyright (C) 2016, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2017, Hubert Figuière <hub at figuiere.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -110,6 +111,7 @@ namespace Poppler
     OptContentModel *q;
 
     QMap<QString, OptContentItem*> m_optContentItems;
+    QList<OptContentItem*> m_headerOptContentItems;
     QList<RadioButtonGroup*> m_rbgroups;
     OptContentItem *m_rootNode;
 
diff --git a/qt5/src/poppler-optcontent.cc b/qt5/src/poppler-optcontent.cc
index 53364ef..15ba650 100644
--- a/qt5/src/poppler-optcontent.cc
+++ b/qt5/src/poppler-optcontent.cc
@@ -4,6 +4,7 @@
  * Copyright (C) 2008, 2014, Pino Toscano <pino at kde.org>
  * Copyright (C) 2008, Carlos Garcia Campos <carlosgc at gnome.org>
  * Copyright (C) 2015, 2016, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2017, Hubert Figuière <hub at figuiere.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -190,6 +191,7 @@ namespace Poppler
   {
     qDeleteAll( m_optContentItems );
     qDeleteAll( m_rbgroups );
+    qDeleteAll( m_headerOptContentItems );
     delete m_rootNode;
   }
 
@@ -217,6 +219,7 @@ namespace Poppler
       } else if ( orderItem.isString() ) {
 	GooString *label = orderItem.getString();
 	OptContentItem *header = new OptContentItem ( UnicodeParsedString ( label ) );
+	m_headerOptContentItems.append( header );
 	addChild( parentNode, header );
 	parentNode = header;
 	lastItem = header;
diff --git a/qt5/tests/check_links.cpp b/qt5/tests/check_links.cpp
index 4d00272..7a39838 100644
--- a/qt5/tests/check_links.cpp
+++ b/qt5/tests/check_links.cpp
@@ -68,6 +68,8 @@ void TestLinks::checkDests_xr01()
     QCOMPARE( dest.destinationName(), QString::fromLatin1("section.2") );
     }
 
+    qDeleteAll(links);
+    delete page;
     delete doc;
 }
 


More information about the poppler mailing list