[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/source vcl/unx

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 27 10:15:54 UTC 2019


 include/vcl/weld.hxx          |    2 +-
 sfx2/source/appl/sfxhelp.cxx  |    2 +-
 vcl/source/app/salvtables.cxx |   10 ++++++----
 vcl/unx/gtk3/gtk3gtkinst.cxx  |    8 +++++---
 4 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 89a95f5fa5a2e10d2c67d33270fa31404df33fd5
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Mar 27 09:40:31 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Mar 27 11:15:27 2019 +0100

    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 at collabora.co.uk>

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


More information about the Libreoffice-commits mailing list