aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/qpdf/QPDFObjectHandle.hh2
-rw-r--r--libqpdf/QPDF_Array.cc13
-rw-r--r--libqpdf/SparseOHArray.cc8
-rw-r--r--libqpdf/qpdf/SparseOHArray.hh1
4 files changed, 9 insertions, 15 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index ecb50ba0..ee424e39 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -1494,10 +1494,8 @@ class QPDFObjectHandle
// disconnected().
class DisconnectAccess
{
- friend class QPDF_Array;
friend class QPDF_Dictionary;
friend class QPDF_Stream;
- friend class SparseOHArray;
private:
static void
diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc
index afec05af..1f1ce55a 100644
--- a/libqpdf/QPDF_Array.cc
+++ b/libqpdf/QPDF_Array.cc
@@ -116,11 +116,16 @@ void
QPDF_Array::disconnect()
{
if (sparse) {
- sp_elements.disconnect();
+ for (auto& item: sp_elements.elements) {
+ auto& obj = item.second;
+ if (!obj->getObjGen().isIndirect()) {
+ obj->disconnect();
+ }
+ }
} else {
- for (auto const& iter: elements) {
- if (iter) {
- QPDFObjectHandle::DisconnectAccess::disconnect(iter);
+ for (auto& obj: elements) {
+ if (!obj->getObjGen().isIndirect()) {
+ obj->disconnect();
}
}
}
diff --git a/libqpdf/SparseOHArray.cc b/libqpdf/SparseOHArray.cc
index 6a1c976a..c830d035 100644
--- a/libqpdf/SparseOHArray.cc
+++ b/libqpdf/SparseOHArray.cc
@@ -1,13 +1,5 @@
#include <qpdf/SparseOHArray.hh>
-void
-SparseOHArray::disconnect()
-{
- for (auto& iter: this->elements) {
- QPDFObjectHandle::DisconnectAccess::disconnect(iter.second);
- }
-}
-
SparseOHArray
SparseOHArray::copy()
{
diff --git a/libqpdf/qpdf/SparseOHArray.hh b/libqpdf/qpdf/SparseOHArray.hh
index 1b31f266..e7733472 100644
--- a/libqpdf/qpdf/SparseOHArray.hh
+++ b/libqpdf/qpdf/SparseOHArray.hh
@@ -17,7 +17,6 @@ class SparseOHArray
return n_elements;
}
SparseOHArray copy();
- void disconnect();
private:
friend class QPDF_Array;