aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-09-02 14:53:27 +0200
committerJay Berkenbilt <ejb@ql.org>2022-09-02 14:53:27 +0200
commita59e7ac7ec1ab018bf28518c065d8c86773db339 (patch)
tree281bd9ffffdb463bf131ecd5ad6ebc25807cecc8 /include
parentda0b0e405d325a212ae571e291b84965aa674332 (diff)
downloadqpdf-a59e7ac7ec1ab018bf28518c065d8c86773db339.tar.zst
Disable copying/assigning to QPDF objects, add QPDF::create()
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDF.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
index 68cc333b..567817f1 100644
--- a/include/qpdf/QPDF.hh
+++ b/include/qpdf/QPDF.hh
@@ -64,6 +64,9 @@ class QPDF
QPDF_DLL
~QPDF();
+ QPDF_DLL
+ static std::shared_ptr<QPDF> create();
+
// Associate a file with a QPDF object and do initial parsing of
// the file. PDF objects are not read until they are needed. A
// QPDF object may be associated with only one file in its
@@ -929,6 +932,15 @@ class QPDF
static bool test_json_validators();
private:
+ // It has never been safe to copy QPDF objects as there is code in
+ // the library that assumes there are no copies of a QPDF object.
+ // Copying QPDF objects was not prevented by the API until qpdf
+ // 11. If you have been copying QPDF objects, use
+ // std::shared_ptr<QPDF> instead. From qpdf 11, you can use
+ // QPDF::create to create them.
+ QPDF(QPDF const&) = delete;
+ QPDF& operator=(QPDF const&) = delete;
+
static std::string const qpdf_version;
class ObjCache