[poppler] qt5/src qt6/src

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Sep 6 21:59:01 UTC 2021


 qt5/src/poppler-page.cc |   11 ++++-------
 qt6/src/poppler-page.cc |   11 ++++-------
 2 files changed, 8 insertions(+), 14 deletions(-)

New commits:
commit 736337fdab52ba77e1877347adff595136f74d73
Author: Thomas Huxhorn <thomas.huxhorn at web.de>
Date:   Sun Aug 29 12:18:57 2021 +0200

    save the trouble of remembering to delete the pointer

diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc
index 65f39bb3..b35894cf 100644
--- a/qt5/src/poppler-page.cc
+++ b/qt5/src/poppler-page.cc
@@ -26,6 +26,7 @@
  * Copyright (C) 2020 Oliver Sander <oliver.sander at tu-dresden.de>
  * Copyright (C) 2020 Philipp Knechtges <philipp-dev at knechtges.com>
  * Copyright (C) 2021 Hubert Figuiere <hub at figuiere.net>
+ * Copyright (C) 2021 Thomas Huxhorn <thomas.huxhorn at web.de>
  *
  * 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
@@ -723,23 +724,20 @@ QList<TextBox *> Page::textList(Rotation rotate) const
 
 QList<TextBox *> Page::textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const
 {
-    TextOutputDev *output_dev;
-
     QList<TextBox *> output_list;
 
-    output_dev = new TextOutputDev(nullptr, false, 0, false, false);
+    TextOutputDev output_dev(nullptr, false, 0, false, false);
 
     int rotation = (int)rotate * 90;
 
     TextExtractionAbortHelper abortHelper(shouldAbortExtractionCallback, closure);
-    m_page->parentDoc->doc->displayPageSlice(output_dev, m_page->index + 1, 72, 72, rotation, false, false, false, -1, -1, -1, -1, shouldAbortExtractionCallback ? shouldAbortExtractionInternalCallback : nullAbortCallBack, &abortHelper,
+    m_page->parentDoc->doc->displayPageSlice(&output_dev, m_page->index + 1, 72, 72, rotation, false, false, false, -1, -1, -1, -1, shouldAbortExtractionCallback ? shouldAbortExtractionInternalCallback : nullAbortCallBack, &abortHelper,
                                              nullptr, nullptr, true);
 
-    TextWordList *word_list = output_dev->makeWordList();
+    TextWordList *word_list = output_dev.makeWordList();
 
     if (!word_list || (shouldAbortExtractionCallback && shouldAbortExtractionCallback(closure))) {
         delete word_list;
-        delete output_dev;
         return output_list;
     }
 
@@ -774,7 +772,6 @@ QList<TextBox *> Page::textList(Rotation rotate, ShouldAbortQueryFunc shouldAbor
     }
 
     delete word_list;
-    delete output_dev;
 
     return output_list;
 }
diff --git a/qt6/src/poppler-page.cc b/qt6/src/poppler-page.cc
index a8d00db1..11a60410 100644
--- a/qt6/src/poppler-page.cc
+++ b/qt6/src/poppler-page.cc
@@ -25,6 +25,7 @@
  * Copyright (C) 2018, 2021 Nelson Benítez León <nbenitezl at gmail.com>
  * Copyright (C) 2020 Philipp Knechtges <philipp-dev at knechtges.com>
  * Copyright (C) 2021 Hubert Figuiere <hub at figuiere.net>
+ * Copyright (C) 2021 Thomas Huxhorn <thomas.huxhorn at web.de>
  *
  * 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
@@ -694,23 +695,20 @@ std::vector<std::unique_ptr<TextBox>> Page::textList(Rotation rotate) const
 
 std::vector<std::unique_ptr<TextBox>> Page::textList(Rotation rotate, ShouldAbortQueryFunc shouldAbortExtractionCallback, const QVariant &closure) const
 {
-    TextOutputDev *output_dev;
-
     std::vector<std::unique_ptr<TextBox>> output_list;
 
-    output_dev = new TextOutputDev(nullptr, false, 0, false, false);
+    TextOutputDev output_dev(nullptr, false, 0, false, false);
 
     int rotation = (int)rotate * 90;
 
     TextExtractionAbortHelper abortHelper(shouldAbortExtractionCallback, closure);
-    m_page->parentDoc->doc->displayPageSlice(output_dev, m_page->index + 1, 72, 72, rotation, false, false, false, -1, -1, -1, -1, shouldAbortExtractionCallback ? shouldAbortExtractionInternalCallback : nullAbortCallBack, &abortHelper,
+    m_page->parentDoc->doc->displayPageSlice(&output_dev, m_page->index + 1, 72, 72, rotation, false, false, false, -1, -1, -1, -1, shouldAbortExtractionCallback ? shouldAbortExtractionInternalCallback : nullAbortCallBack, &abortHelper,
                                              nullptr, nullptr, true);
 
-    TextWordList *word_list = output_dev->makeWordList();
+    TextWordList *word_list = output_dev.makeWordList();
 
     if (!word_list || (shouldAbortExtractionCallback && shouldAbortExtractionCallback(closure))) {
         delete word_list;
-        delete output_dev;
         return output_list;
     }
 
@@ -745,7 +743,6 @@ std::vector<std::unique_ptr<TextBox>> Page::textList(Rotation rotate, ShouldAbor
     }
 
     delete word_list;
-    delete output_dev;
 
     return output_list;
 }


More information about the poppler mailing list