diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-27 09:40:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-27 11:15:27 +0100 |
commit | 89a95f5fa5a2e10d2c67d33270fa31404df33fd5 (patch) | |
tree | 7c3423db53a43b7873208921cfa38d7a9ec4fe33 | |
parent | b859e9f646b6f023beeca01c59673a7b442e2332 (diff) |
return by unique_ptr from weld_parent
Change-Id: I3582b3000330fab96f6abef0f412b648b0573af4
Reviewed-on: https://gerrit.libreoffice.org/69793
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/vcl/weld.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 8 |
4 files changed, 13 insertions, 9 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index a180243019df..91fc19f65a87 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -211,7 +211,7 @@ public: virtual void freeze() = 0; virtual void thaw() = 0; - virtual Container* weld_parent() const = 0; + virtual std::unique_ptr<Container> weld_parent() const = 0; //iterate upwards through the hierarchy starting at this widgets parent, //calling func with their helpid until func returns true or we run out of diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 99042b9e0f04..8567731b0b77 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -649,7 +649,7 @@ OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* p if (!sHelpText.isEmpty()) xParent.reset(); else - xParent.reset(xParent->weld_parent()); + xParent = xParent->weld_parent(); } if (bIsDebug && sHelpText.isEmpty()) diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 01069b134a81..a2746d772b30 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -593,7 +593,7 @@ public: m_xWidget->SetUpdateMode(true); } - virtual weld::Container* weld_parent() const override; + virtual std::unique_ptr<weld::Container> weld_parent() const override; virtual ~SalInstanceWidget() override { @@ -832,10 +832,12 @@ public: } }; -weld::Container* SalInstanceWidget::weld_parent() const +std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const { vcl::Window* pParent = m_xWidget->GetParent(); - return pParent ? new SalInstanceContainer(pParent, m_pBuilder, false) : nullptr; + if (!pParent) + return nullptr; + return std::make_unique<SalInstanceContainer>(pParent, m_pBuilder, false); } class SalInstanceWindow : public SalInstanceContainer, public virtual weld::Window @@ -4686,7 +4688,7 @@ namespace weld if (!rRelocateId.isEmpty()) { m_xRelocate = m_xBuilder->weld_container(rRelocateId); - m_xOrigParent.reset(m_xRelocate->weld_parent()); + m_xOrigParent = m_xRelocate->weld_parent(); //fdo#75121, a bit tricky because the widgets we want to align with //don't actually exist in the ui description, they're implied m_xOrigParent->move(m_xRelocate.get(), m_xContentArea.get()); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 4dd06f61b4eb..0235b1b0f5b6 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1809,7 +1809,7 @@ public: return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); } - virtual weld::Container* weld_parent() const override; + virtual std::unique_ptr<weld::Container> weld_parent() const override; virtual OString get_buildable_name() const override { @@ -2368,10 +2368,12 @@ public: } }; -weld::Container* GtkInstanceWidget::weld_parent() const +std::unique_ptr<weld::Container> GtkInstanceWidget::weld_parent() const { GtkWidget* pParent = gtk_widget_get_parent(m_pWidget); - return pParent ? new GtkInstanceContainer(GTK_CONTAINER(pParent), m_pBuilder, false) : nullptr; + if (!pParent) + return nullptr; + return std::make_unique<GtkInstanceContainer>(GTK_CONTAINER(pParent), m_pBuilder, false); } class GtkInstanceWindow : public GtkInstanceContainer, public virtual weld::Window |