From 491fbb1de3697b566f1af8925896053b2a39f33c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 21 Apr 2020 09:33:19 +0200 Subject: [PATCH] return shared_ptr from AnyWidget::Clone which is what the only call-site wants Change-Id: I74aa7b9ce059890eb1bdd84d7a0a331ecf227be3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92606 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/vcl/pdfwriter.hxx | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index b3b0f2c6e691..b4d1ac58b1af 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -262,7 +262,7 @@ public: WidgetType getType() const { return Type; } - virtual std::unique_ptr Clone() const = 0; + virtual std::shared_ptr Clone() const = 0; protected: // note that this equals the default compiler-generated copy-ctor, but we want to have it @@ -321,9 +321,9 @@ public: Dest( -1 ), Submit( false ), SubmitGet( false ) {} - virtual std::unique_ptr Clone() const override + virtual std::shared_ptr Clone() const override { - return std::unique_ptr(new PushButtonWidget( *this )); + return std::make_shared( *this ); } }; @@ -336,9 +336,9 @@ public: Checked( false ) {} - virtual std::unique_ptr Clone() const override + virtual std::shared_ptr Clone() const override { - return std::unique_ptr(new CheckBoxWidget( *this )); + return std::make_shared( *this ); } }; @@ -354,9 +354,9 @@ public: RadioGroup( 0 ) {} - virtual std::unique_ptr Clone() const override + virtual std::shared_ptr Clone() const override { - return std::unique_ptr(new RadioButtonWidget( *this )); + return std::make_shared( *this ); } // radio buttons having the same RadioGroup id comprise one // logical radio button group, that is at most one of the RadioButtons @@ -383,9 +383,9 @@ public: MaxLen( 0 ) {} - virtual std::unique_ptr Clone() const override + virtual std::shared_ptr Clone() const override { - return std::unique_ptr(new EditWidget( *this )); + return std::make_shared( *this ); } }; @@ -405,9 +405,9 @@ public: MultiSelect( false ) {} - virtual std::unique_ptr Clone() const override + virtual std::shared_ptr Clone() const override { - return std::unique_ptr(new ListBoxWidget( *this )); + return std::make_shared( *this ); } }; @@ -421,9 +421,9 @@ public: : AnyWidget( vcl::PDFWriter::ComboBox ) {} - virtual std::unique_ptr Clone() const override + virtual std::shared_ptr Clone() const override { - return std::unique_ptr(new ComboBoxWidget( *this )); + return std::make_shared( *this ); } }; @@ -433,9 +433,9 @@ public: : AnyWidget( vcl::PDFWriter::Signature ) {} - virtual std::unique_ptr Clone() const override + virtual std::shared_ptr Clone() const override { - return std::unique_ptr(new SignatureWidget( *this )); + return std::make_shared( *this ); } };