include/vcl/weld.hxx                 |  107 +++++++--------------
 vcl/inc/jsdialog/jsdialogbuilder.hxx |   37 ++-----
 vcl/inc/salvtables.hxx               |  104 +++++++-------------
 vcl/jsdialog/jsdialogbuilder.cxx     |   68 +++++--------
 vcl/source/app/salvtables.cxx        |  175 ++++++++++++++---------------------
 vcl/unx/gtk3/gtk3gtkinst.cxx         |  147 ++++++++++++++---------------
 6 files changed, 261 insertions(+), 377 deletions(-)

New commits:
commit 66ce7a7bcae0e0e38fc56f6780eec86e06acfd90
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Oct 6 09:45:54 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Oct 6 14:43:09 2020 +0200

    drop ownership argument
    
    we have never needed to diverge from the defaults of true for toplevels
    and false for non-toplevels
    
    Change-Id: I884b1e221d0ec44895214363d391c27e3e1707f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104019
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 6f227c7cbb6a..db1b6d519d1f 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2238,80 +2238,49 @@ public:
 class VCL_DLLPUBLIC Builder
 {
 public:
-    virtual std::unique_ptr<MessageDialog> weld_message_dialog(const OString& 
id,
-                                                               bool 
bTakeOwnership = true)
-        = 0;
-    virtual std::unique_ptr<Dialog> weld_dialog(const OString& id, bool 
bTakeOwnership = true) = 0;
-    virtual std::unique_ptr<Assistant> weld_assistant(const OString& id, bool 
bTakeOwnership = true)
-        = 0;
-    virtual std::unique_ptr<Widget> weld_widget(const OString& id, bool 
bTakeOwnership = false) = 0;
-    virtual std::unique_ptr<Container> weld_container(const OString& id,
-                                                      bool bTakeOwnership = 
false)
-        = 0;
-    virtual std::unique_ptr<Box> weld_box(const OString& id, bool 
bTakeOwnership = false) = 0;
-    virtual std::unique_ptr<Paned> weld_paned(const OString& id, bool 
bTakeOwnership = false) = 0;
-    virtual std::unique_ptr<Button> weld_button(const OString& id, bool 
bTakeOwnership = false) = 0;
-    virtual std::unique_ptr<MenuButton> weld_menu_button(const OString& id,
-                                                         bool bTakeOwnership = 
false)
-        = 0;
-    virtual std::unique_ptr<Frame> weld_frame(const OString& id, bool 
bTakeOwnership = false) = 0;
-    virtual std::unique_ptr<ScrolledWindow> weld_scrolled_window(const 
OString& id,
-                                                                 bool 
bTakeOwnership = false)
-        = 0;
-    virtual std::unique_ptr<Notebook> weld_notebook(const OString& id, bool 
bTakeOwnership = false)
-        = 0;
-    virtual std::unique_ptr<ToggleButton> weld_toggle_button(const OString& id,
-                                                             bool 
bTakeOwnership = false)
-        = 0;
-    virtual std::unique_ptr<RadioButton> weld_radio_button(const OString& id,
-                                                           bool bTakeOwnership 
= false)
-        = 0;
-    virtual std::unique_ptr<CheckButton> weld_check_button(const OString& id,
-                                                           bool bTakeOwnership 
= false)
-        = 0;
-    virtual std::unique_ptr<LinkButton> weld_link_button(const OString& id,
-                                                         bool bTakeOwnership = 
false)
-        = 0;
-    virtual std::unique_ptr<SpinButton> weld_spin_button(const OString& id,
-                                                         bool bTakeOwnership = 
false)
-        = 0;
-    virtual std::unique_ptr<MetricSpinButton>
-    weld_metric_spin_button(const OString& id, FieldUnit eUnit, bool 
bTakeOwnership = false) = 0;
-    virtual std::unique_ptr<FormattedSpinButton>
-    weld_formatted_spin_button(const OString& id, bool bTakeOwnership = false) 
= 0;
-    virtual std::unique_ptr<ComboBox> weld_combo_box(const OString& id, bool 
bTakeOwnership = false)
-        = 0;
-    virtual std::unique_ptr<TreeView> weld_tree_view(const OString& id, bool 
bTakeOwnership = false)
-        = 0;
-    virtual std::unique_ptr<IconView> weld_icon_view(const OString& id, bool 
bTakeOwnership = false)
-        = 0;
-    virtual std::unique_ptr<Label> weld_label(const OString& id, bool 
bTakeOwnership = false) = 0;
-    virtual std::unique_ptr<TextView> weld_text_view(const OString& id, bool 
bTakeOwnership = false)
-        = 0;
-    virtual std::unique_ptr<Expander> weld_expander(const OString& id, bool 
bTakeOwnership = false)
-        = 0;
-    virtual std::unique_ptr<Entry> weld_entry(const OString& id, bool 
bTakeOwnership = false) = 0;
-    virtual std::unique_ptr<Scale> weld_scale(const OString& id, bool 
bTakeOwnership = false) = 0;
-    virtual std::unique_ptr<ProgressBar> weld_progress_bar(const OString& id,
-                                                           bool bTakeOwnership 
= false)
-        = 0;
-    virtual std::unique_ptr<Spinner> weld_spinner(const OString& id, bool 
bTakeOwnership = false)
-        = 0;
-    virtual std::unique_ptr<Image> weld_image(const OString& id, bool 
bTakeOwnership = false) = 0;
-    virtual std::unique_ptr<Calendar> weld_calendar(const OString& id, bool 
bTakeOwnership = false)
+    virtual std::unique_ptr<MessageDialog> weld_message_dialog(const OString& 
id) = 0;
+    virtual std::unique_ptr<Dialog> weld_dialog(const OString& id) = 0;
+    virtual std::unique_ptr<Assistant> weld_assistant(const OString& id) = 0;
+    virtual std::unique_ptr<Widget> weld_widget(const OString& id) = 0;
+    virtual std::unique_ptr<Container> weld_container(const OString& id) = 0;
+    virtual std::unique_ptr<Box> weld_box(const OString& id) = 0;
+    virtual std::unique_ptr<Paned> weld_paned(const OString& id) = 0;
+    virtual std::unique_ptr<Button> weld_button(const OString& id) = 0;
+    virtual std::unique_ptr<MenuButton> weld_menu_button(const OString& id) = 
0;
+    virtual std::unique_ptr<Frame> weld_frame(const OString& id) = 0;
+    virtual std::unique_ptr<ScrolledWindow> weld_scrolled_window(const 
OString& id) = 0;
+    virtual std::unique_ptr<Notebook> weld_notebook(const OString& id) = 0;
+    virtual std::unique_ptr<ToggleButton> weld_toggle_button(const OString& 
id) = 0;
+    virtual std::unique_ptr<RadioButton> weld_radio_button(const OString& id) 
= 0;
+    virtual std::unique_ptr<CheckButton> weld_check_button(const OString& id) 
= 0;
+    virtual std::unique_ptr<LinkButton> weld_link_button(const OString& id) = 
0;
+    virtual std::unique_ptr<SpinButton> weld_spin_button(const OString& id) = 
0;
+    virtual std::unique_ptr<MetricSpinButton> weld_metric_spin_button(const 
OString& id,
+                                                                      
FieldUnit eUnit)
         = 0;
+    virtual std::unique_ptr<FormattedSpinButton> 
weld_formatted_spin_button(const OString& id) = 0;
+    virtual std::unique_ptr<ComboBox> weld_combo_box(const OString& id) = 0;
+    virtual std::unique_ptr<TreeView> weld_tree_view(const OString& id) = 0;
+    virtual std::unique_ptr<IconView> weld_icon_view(const OString& id) = 0;
+    virtual std::unique_ptr<Label> weld_label(const OString& id) = 0;
+    virtual std::unique_ptr<TextView> weld_text_view(const OString& id) = 0;
+    virtual std::unique_ptr<Expander> weld_expander(const OString& id) = 0;
+    virtual std::unique_ptr<Entry> weld_entry(const OString& id) = 0;
+    virtual std::unique_ptr<Scale> weld_scale(const OString& id) = 0;
+    virtual std::unique_ptr<ProgressBar> weld_progress_bar(const OString& id) 
= 0;
+    virtual std::unique_ptr<Spinner> weld_spinner(const OString& id) = 0;
+    virtual std::unique_ptr<Image> weld_image(const OString& id) = 0;
+    virtual std::unique_ptr<Calendar> weld_calendar(const OString& id) = 0;
     virtual std::unique_ptr<DrawingArea>
     weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
-                      FactoryFunction pUITestFactoryFunction = nullptr, void* 
pUserData = nullptr,
-                      bool bTakeOwnership = false)
-        = 0;
-    virtual std::unique_ptr<EntryTreeView>
-    weld_entry_tree_view(const OString& containerid, const OString& entryid,
-                         const OString& treeviewid, bool bTakeOwnership = 
false)
+                      FactoryFunction pUITestFactoryFunction = nullptr, void* 
pUserData = nullptr)
         = 0;
-    virtual std::unique_ptr<Menu> weld_menu(const OString& id, bool 
bTakeOwnership = true) = 0;
-    virtual std::unique_ptr<Toolbar> weld_toolbar(const OString& id, bool 
bTakeOwnership = false)
+    virtual std::unique_ptr<EntryTreeView> weld_entry_tree_view(const OString& 
containerid,
+                                                                const OString& 
entryid,
+                                                                const OString& 
treeviewid)
         = 0;
+    virtual std::unique_ptr<Menu> weld_menu(const OString& id) = 0;
+    virtual std::unique_ptr<Toolbar> weld_toolbar(const OString& id) = 0;
     virtual std::unique_ptr<SizeGroup> create_size_group() = 0;
     /* return a Dialog suitable to take a screenshot of containing the 
contents of the .ui file.
 
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index b141287cf89a..f486685c7dd9 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -74,30 +74,20 @@ public:
                       const css::uno::Reference<css::frame::XFrame>& rFrame,
                       sal_uInt64 nWindowId = 0);
     virtual ~JSInstanceBuilder() override;
-    virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id,
-                                                      bool bTakeOwnership = 
true) override;
-    virtual std::unique_ptr<weld::Label> weld_label(const OString& id,
-                                                    bool bTakeOwnership = 
false) override;
-    virtual std::unique_ptr<weld::Button> weld_button(const OString& id,
-                                                      bool bTakeOwnership = 
false) override;
-    virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id,
-                                                    bool bTakeOwnership = 
false) override;
-    virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id,
-                                                           bool bTakeOwnership 
= false) override;
-    virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id,
-                                                          bool bTakeOwnership 
= false) override;
-    virtual std::unique_ptr<weld::SpinButton>
-    weld_spin_button(const OString& id, bool bTakeOwnership = false) override;
-    virtual std::unique_ptr<weld::CheckButton>
-    weld_check_button(const OString& id, bool bTakeOwnership = false) override;
+    virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id) 
override;
+    virtual std::unique_ptr<weld::Label> weld_label(const OString& id) 
override;
+    virtual std::unique_ptr<weld::Button> weld_button(const OString& id) 
override;
+    virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id) 
override;
+    virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id) 
override;
+    virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id) 
override;
+    virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString& 
id) override;
+    virtual std::unique_ptr<weld::CheckButton> weld_check_button(const 
OString& id) override;
     virtual std::unique_ptr<weld::DrawingArea>
     weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
-                      FactoryFunction pUITestFactoryFunction = nullptr, void* 
pUserData = nullptr,
-                      bool bTakeOwnership = false) override;
-    std::unique_ptr<weld::Toolbar> weld_toolbar(const OString& id,
-                                                bool bTakeOwnership = false) 
override;
-    std::unique_ptr<weld::TextView> weld_text_view(const OString& id,
-                                                   bool bTakeOwnership = 
false) override;
+                      FactoryFunction pUITestFactoryFunction = nullptr,
+                      void* pUserData = nullptr) override;
+    std::unique_ptr<weld::Toolbar> weld_toolbar(const OString& id) override;
+    std::unique_ptr<weld::TextView> weld_text_view(const OString& id) override;
 
     static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent,
                                                     VclMessageType 
eMessageType,
@@ -239,8 +229,7 @@ class JSDrawingArea : public SalInstanceDrawingArea, public 
JSDialogSender
 public:
     JSDrawingArea(VclPtr<vcl::Window> aOwnedToplevel, VclDrawingArea* 
pDrawingArea,
                   SalInstanceBuilder* pBuilder, const a11yref& rAlly,
-                  FactoryFunction pUITestFactoryFunction, void* pUserData,
-                  bool bTakeOwnership = false);
+                  FactoryFunction pUITestFactoryFunction, void* pUserData);
 
     virtual void queue_draw() override;
     virtual void queue_draw_area(int x, int y, int width, int height) override;
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 391e61ea3c65..affca7347051 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -36,116 +36,84 @@ public:
                        const css::uno::Reference<css::frame::XFrame>& rFrame
                        = css::uno::Reference<css::frame::XFrame>());
 
-    virtual std::unique_ptr<weld::MessageDialog>
-    weld_message_dialog(const OString& id, bool bTakeOwnership = true) 
override;
+    virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const 
OString& id) override;
 
-    virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id,
-                                                      bool bTakeOwnership = 
true) override;
+    virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::Assistant> weld_assistant(const OString& id,
-                                                            bool 
bTakeOwnership = true) override;
+    virtual std::unique_ptr<weld::Assistant> weld_assistant(const OString& id) 
override;
 
     virtual std::unique_ptr<weld::Window> create_screenshot_window() override;
 
-    virtual std::unique_ptr<weld::Widget> weld_widget(const OString& id,
-                                                      bool bTakeOwnership = 
false) override;
+    virtual std::unique_ptr<weld::Widget> weld_widget(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::Container> weld_container(const OString& id,
-                                                            bool 
bTakeOwnership = false) override;
+    virtual std::unique_ptr<weld::Container> weld_container(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::Box> weld_box(const OString& id,
-                                                bool bTakeOwnership = false) 
override;
+    virtual std::unique_ptr<weld::Box> weld_box(const OString& id) override;
 
-    virtual std::unique_ptr<weld::Paned> weld_paned(const OString& id,
-                                                    bool bTakeOwnership = 
false) override;
+    virtual std::unique_ptr<weld::Paned> weld_paned(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::Frame> weld_frame(const OString& id,
-                                                    bool bTakeOwnership = 
false) override;
+    virtual std::unique_ptr<weld::Frame> weld_frame(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::ScrolledWindow>
-    weld_scrolled_window(const OString& id, bool bTakeOwnership = false) 
override;
+    virtual std::unique_ptr<weld::ScrolledWindow> weld_scrolled_window(const 
OString& id) override;
 
-    virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id,
-                                                          bool bTakeOwnership 
= false) override;
+    virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::Button> weld_button(const OString& id,
-                                                      bool bTakeOwnership = 
false) override;
+    virtual std::unique_ptr<weld::Button> weld_button(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::MenuButton>
-    weld_menu_button(const OString& id, bool bTakeOwnership = false) override;
+    virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OString& 
id) override;
 
-    virtual std::unique_ptr<weld::LinkButton>
-    weld_link_button(const OString& id, bool bTakeOwnership = false) override;
+    virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OString& 
id) override;
 
-    virtual std::unique_ptr<weld::ToggleButton>
-    weld_toggle_button(const OString& id, bool bTakeOwnership = false) 
override;
+    virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const 
OString& id) override;
 
-    virtual std::unique_ptr<weld::RadioButton>
-    weld_radio_button(const OString& id, bool bTakeOwnership = false) override;
+    virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const 
OString& id) override;
 
-    virtual std::unique_ptr<weld::CheckButton>
-    weld_check_button(const OString& id, bool bTakeOwnership = false) override;
+    virtual std::unique_ptr<weld::CheckButton> weld_check_button(const 
OString& id) override;
 
-    virtual std::unique_ptr<weld::Scale> weld_scale(const OString& id,
-                                                    bool bTakeOwnership = 
false) override;
+    virtual std::unique_ptr<weld::Scale> weld_scale(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::ProgressBar>
-    weld_progress_bar(const OString& id, bool bTakeOwnership = false) override;
+    virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const 
OString& id) override;
 
-    virtual std::unique_ptr<weld::Spinner> weld_spinner(const OString& id,
-                                                        bool bTakeOwnership = 
false) override;
+    virtual std::unique_ptr<weld::Spinner> weld_spinner(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::Image> weld_image(const OString& id,
-                                                    bool bTakeOwnership = 
false) override;
+    virtual std::unique_ptr<weld::Image> weld_image(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::Calendar> weld_calendar(const OString& id,
-                                                          bool bTakeOwnership 
= false) override;
+    virtual std::unique_ptr<weld::Calendar> weld_calendar(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id,
-                                                    bool bTakeOwnership = 
false) override;
+    virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::SpinButton>
-    weld_spin_button(const OString& id, bool bTakeOwnership = false) override;
+    virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString& 
id) override;
 
     virtual std::unique_ptr<weld::MetricSpinButton>
-    weld_metric_spin_button(const OString& id, FieldUnit eUnit,
-                            bool bTakeOwnership = false) override;
+    weld_metric_spin_button(const OString& id, FieldUnit eUnit) override;
 
     virtual std::unique_ptr<weld::FormattedSpinButton>
-    weld_formatted_spin_button(const OString& id, bool bTakeOwnership = false) 
override;
+    weld_formatted_spin_button(const OString& id) override;
 
-    virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id,
-                                                           bool bTakeOwnership 
= false) override;
+    virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id) 
override;
 
     virtual std::unique_ptr<weld::EntryTreeView>
     weld_entry_tree_view(const OString& containerid, const OString& entryid,
-                         const OString& treeviewid, bool bTakeOwnership = 
false) override;
+                         const OString& treeviewid) override;
 
-    virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString& id,
-                                                           bool bTakeOwnership 
= false) override;
+    virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString& id,
-                                                           bool bTakeOwnership 
= false) override;
+    virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::Label> weld_label(const OString& id,
-                                                    bool bTakeOwnership = 
false) override;
+    virtual std::unique_ptr<weld::Label> weld_label(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::TextView> weld_text_view(const OString& id,
-                                                           bool bTakeOwnership 
= false) override;
+    virtual std::unique_ptr<weld::TextView> weld_text_view(const OString& id) 
override;
 
-    virtual std::unique_ptr<weld::Expander> weld_expander(const OString& id,
-                                                          bool bTakeOwnership 
= false) override;
+    virtual std::unique_ptr<weld::Expander> weld_expander(const OString& id) 
override;
 
     virtual std::unique_ptr<weld::DrawingArea>
     weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
-                      FactoryFunction pUITestFactoryFunction = nullptr, void* 
pUserData = nullptr,
-                      bool bTakeOwnership = false) override;
+                      FactoryFunction pUITestFactoryFunction = nullptr,
+                      void* pUserData = nullptr) override;
 
-    virtual std::unique_ptr<weld::Menu> weld_menu(const OString& id,
-                                                  bool bTakeOwnership = true) 
override;
+    virtual std::unique_ptr<weld::Menu> weld_menu(const OString& id) override;
 
-    virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString& id,
-                                                        bool bTakeOwnership = 
false) override;
+    virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString& id) 
override;
 
     virtual std::unique_ptr<weld::SizeGroup> create_size_group() override;
 
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index af48c181bff6..d18561d80e3b 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -167,7 +167,7 @@ void JSInstanceBuilder::RememberWidget(const OString& id, 
weld::Widget* pWidget)
     }
 }
 
-std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& 
id, bool bTakeOwnership)
+std::unique_ptr<weld::Dialog> JSInstanceBuilder::weld_dialog(const OString& id)
 {
     ::Dialog* pDialog = m_xBuilder->get<::Dialog>(id);
     m_nWindowId = pDialog->GetLOKWindowId();
@@ -176,7 +176,7 @@ std::unique_ptr<weld::Dialog> 
JSInstanceBuilder::weld_dialog(const OString& id,
 
     std::unique_ptr<weld::Dialog> pRet(
         pDialog ? new JSDialog(m_aOwnedToplevel, pDialog, this, false) : 
nullptr);
-    if (bTakeOwnership && pDialog)
+    if (pDialog)
     {
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
         m_aOwnedToplevel.set(pDialog);
@@ -196,11 +196,11 @@ std::unique_ptr<weld::Dialog> 
JSInstanceBuilder::weld_dialog(const OString& id,
     return pRet;
 }
 
-std::unique_ptr<weld::Label> JSInstanceBuilder::weld_label(const OString& id, 
bool bTakeOwnership)
+std::unique_ptr<weld::Label> JSInstanceBuilder::weld_label(const OString& id)
 {
     ::FixedText* pLabel = m_xBuilder->get<FixedText>(id);
     auto pWeldWidget = std::make_unique<JSLabel>(
-        m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog, pLabel, 
this, bTakeOwnership);
+        m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog, pLabel, 
this, false);
 
     if (pWeldWidget)
         RememberWidget(id, pWeldWidget.get());
@@ -208,12 +208,12 @@ std::unique_ptr<weld::Label> 
JSInstanceBuilder::weld_label(const OString& id, bo
     return pWeldWidget;
 }
 
-std::unique_ptr<weld::Button> JSInstanceBuilder::weld_button(const OString& 
id, bool bTakeOwnership)
+std::unique_ptr<weld::Button> JSInstanceBuilder::weld_button(const OString& id)
 {
     ::Button* pButton = m_xBuilder->get<::Button>(id);
     auto pWeldWidget = pButton ? 
std::make_unique<JSButton>(m_bHasTopLevelDialog ? m_aOwnedToplevel
                                                                                
  : m_aParentDialog,
-                                                            pButton, this, 
bTakeOwnership)
+                                                            pButton, this, 
false)
                                : nullptr;
 
     if (pWeldWidget)
@@ -222,12 +222,12 @@ std::unique_ptr<weld::Button> 
JSInstanceBuilder::weld_button(const OString& id,
     return pWeldWidget;
 }
 
-std::unique_ptr<weld::Entry> JSInstanceBuilder::weld_entry(const OString& id, 
bool bTakeOwnership)
+std::unique_ptr<weld::Entry> JSInstanceBuilder::weld_entry(const OString& id)
 {
     Edit* pEntry = m_xBuilder->get<Edit>(id);
     auto pWeldWidget = pEntry ? std::make_unique<JSEntry>(m_bHasTopLevelDialog 
? m_aOwnedToplevel
                                                                                
: m_aParentDialog,
-                                                          pEntry, this, 
bTakeOwnership)
+                                                          pEntry, this, false)
                               : nullptr;
 
     if (pWeldWidget)
@@ -236,8 +236,7 @@ std::unique_ptr<weld::Entry> 
JSInstanceBuilder::weld_entry(const OString& id, bo
     return pWeldWidget;
 }
 
-std::unique_ptr<weld::ComboBox> JSInstanceBuilder::weld_combo_box(const 
OString& id,
-                                                                  bool 
bTakeOwnership)
+std::unique_ptr<weld::ComboBox> JSInstanceBuilder::weld_combo_box(const 
OString& id)
 {
     vcl::Window* pWidget = m_xBuilder->get<vcl::Window>(id);
     ::ComboBox* pComboBox = dynamic_cast<::ComboBox*>(pWidget);
@@ -245,16 +244,15 @@ std::unique_ptr<weld::ComboBox> 
JSInstanceBuilder::weld_combo_box(const OString&
 
     if (pComboBox)
     {
-        pWeldWidget = std::make_unique<JSComboBox>(m_bHasTopLevelDialog ? 
m_aOwnedToplevel
-                                                                        : 
m_aParentDialog,
-                                                   pComboBox, this, 
bTakeOwnership);
+        pWeldWidget = std::make_unique<JSComboBox>(
+            m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog, 
pComboBox, this, false);
     }
     else
     {
         ListBox* pListBox = dynamic_cast<ListBox*>(pWidget);
         pWeldWidget = pListBox ? 
std::make_unique<JSListBox>(m_bHasTopLevelDialog ? m_aOwnedToplevel
                                                                                
   : m_aParentDialog,
-                                                             pListBox, this, 
bTakeOwnership)
+                                                             pListBox, this, 
false)
                                : nullptr;
     }
 
@@ -264,13 +262,12 @@ std::unique_ptr<weld::ComboBox> 
JSInstanceBuilder::weld_combo_box(const OString&
     return pWeldWidget;
 }
 
-std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const 
OString& id,
-                                                                 bool 
bTakeOwnership)
+std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const 
OString& id)
 {
     TabControl* pNotebook = m_xBuilder->get<TabControl>(id);
     auto pWeldWidget = pNotebook ? std::make_unique<JSNotebook>(
                                        m_bHasTopLevelDialog ? m_aOwnedToplevel 
: m_aParentDialog,
-                                       pNotebook, this, bTakeOwnership)
+                                       pNotebook, this, false)
                                  : nullptr;
 
     if (pWeldWidget)
@@ -279,13 +276,12 @@ std::unique_ptr<weld::Notebook> 
JSInstanceBuilder::weld_notebook(const OString&
     return pWeldWidget;
 }
 
-std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const 
OString& id,
-                                                                      bool 
bTakeOwnership)
+std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const 
OString& id)
 {
     FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id);
     auto pWeldWidget = pSpinButton ? std::make_unique<JSSpinButton>(
                                          m_bHasTopLevelDialog ? 
m_aOwnedToplevel : m_aParentDialog,
-                                         pSpinButton, this, bTakeOwnership)
+                                         pSpinButton, this, false)
                                    : nullptr;
 
     if (pWeldWidget)
@@ -294,13 +290,12 @@ std::unique_ptr<weld::SpinButton> 
JSInstanceBuilder::weld_spin_button(const OStr
     return pWeldWidget;
 }
 
-std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const 
OString& id,
-                                                                        bool 
bTakeOwnership)
+std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const 
OString& id)
 {
     CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id);
     auto pWeldWidget = pCheckButton ? std::make_unique<JSCheckButton>(
                                           m_bHasTopLevelDialog ? 
m_aOwnedToplevel : m_aParentDialog,
-                                          pCheckButton, this, bTakeOwnership)
+                                          pCheckButton, this, false)
                                     : nullptr;
 
     if (pWeldWidget)
@@ -311,15 +306,13 @@ std::unique_ptr<weld::CheckButton> 
JSInstanceBuilder::weld_check_button(const OS
 
 std::unique_ptr<weld::DrawingArea>
 JSInstanceBuilder::weld_drawing_area(const OString& id, const a11yref& 
rA11yImpl,
-                                     FactoryFunction pUITestFactoryFunction, 
void* pUserData,
-                                     bool bTakeOwnership)
+                                     FactoryFunction pUITestFactoryFunction, 
void* pUserData)
 {
     VclDrawingArea* pArea = m_xBuilder->get<VclDrawingArea>(id);
-    auto pWeldWidget = pArea
-                           ? std::make_unique<JSDrawingArea>(
-                                 m_bHasTopLevelDialog ? m_aOwnedToplevel : 
m_aParentDialog, pArea,
-                                 this, rA11yImpl, pUITestFactoryFunction, 
pUserData, bTakeOwnership)
-                           : nullptr;
+    auto pWeldWidget = pArea ? std::make_unique<JSDrawingArea>(
+                                   m_bHasTopLevelDialog ? m_aOwnedToplevel : 
m_aParentDialog, pArea,
+                                   this, rA11yImpl, pUITestFactoryFunction, 
pUserData)
+                             : nullptr;
 
     if (pWeldWidget)
         RememberWidget(id, pWeldWidget.get());
@@ -327,13 +320,12 @@ JSInstanceBuilder::weld_drawing_area(const OString& id, 
const a11yref& rA11yImpl
     return pWeldWidget;
 }
 
-std::unique_ptr<weld::Toolbar> JSInstanceBuilder::weld_toolbar(const OString& 
id,
-                                                               bool 
bTakeOwnership)
+std::unique_ptr<weld::Toolbar> JSInstanceBuilder::weld_toolbar(const OString& 
id)
 {
     ToolBox* pToolBox = m_xBuilder->get<ToolBox>(id);
     auto pWeldWidget = pToolBox ? std::make_unique<JSToolbar>(
                                       m_bHasTopLevelDialog ? m_aOwnedToplevel 
: m_aParentDialog,
-                                      pToolBox, this, bTakeOwnership)
+                                      pToolBox, this, false)
                                 : nullptr;
 
     if (pWeldWidget)
@@ -342,13 +334,12 @@ std::unique_ptr<weld::Toolbar> 
JSInstanceBuilder::weld_toolbar(const OString& id
     return pWeldWidget;
 }
 
-std::unique_ptr<weld::TextView> JSInstanceBuilder::weld_text_view(const 
OString& id,
-                                                                  bool 
bTakeOwnership)
+std::unique_ptr<weld::TextView> JSInstanceBuilder::weld_text_view(const 
OString& id)
 {
     VclMultiLineEdit* pTextView = m_xBuilder->get<VclMultiLineEdit>(id);
     auto pWeldWidget = pTextView ? std::make_unique<JSTextView>(
                                        m_bHasTopLevelDialog ? m_aOwnedToplevel 
: m_aParentDialog,
-                                       pTextView, this, bTakeOwnership)
+                                       pTextView, this, false)
                                  : nullptr;
 
     if (pWeldWidget)
@@ -574,10 +565,9 @@ void JSCheckButton::set_active(bool active)
 
 JSDrawingArea::JSDrawingArea(VclPtr<vcl::Window> aOwnedToplevel, 
VclDrawingArea* pDrawingArea,
                              SalInstanceBuilder* pBuilder, const a11yref& 
rAlly,
-                             FactoryFunction pUITestFactoryFunction, void* 
pUserData,
-                             bool bTakeOwnership)
+                             FactoryFunction pUITestFactoryFunction, void* 
pUserData)
     : SalInstanceDrawingArea(pDrawingArea, pBuilder, rAlly, 
pUITestFactoryFunction, pUserData,
-                             bTakeOwnership)
+                             false)
     , JSDialogSender(aOwnedToplevel)
 {
 }
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 40f5ef8be163..28deb03208aa 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6540,13 +6540,12 @@ SalInstanceBuilder::SalInstanceBuilder(vcl::Window* 
pParent, const OUString& rUI
 {
 }
 
-std::unique_ptr<weld::MessageDialog> 
SalInstanceBuilder::weld_message_dialog(const OString& id,
-                                                                             
bool bTakeOwnership)
+std::unique_ptr<weld::MessageDialog> 
SalInstanceBuilder::weld_message_dialog(const OString& id)
 {
     MessageDialog* pMessageDialog = m_xBuilder->get<MessageDialog>(id);
     std::unique_ptr<weld::MessageDialog> pRet(
         pMessageDialog ? new SalInstanceMessageDialog(pMessageDialog, this, 
false) : nullptr);
-    if (bTakeOwnership && pMessageDialog)
+    if (pMessageDialog)
     {
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
         m_aOwnedToplevel.set(pMessageDialog);
@@ -6555,13 +6554,12 @@ std::unique_ptr<weld::MessageDialog> 
SalInstanceBuilder::weld_message_dialog(con
     return pRet;
 }
 
-std::unique_ptr<weld::Dialog> SalInstanceBuilder::weld_dialog(const OString& 
id,
-                                                              bool 
bTakeOwnership)
+std::unique_ptr<weld::Dialog> SalInstanceBuilder::weld_dialog(const OString& 
id)
 {
     Dialog* pDialog = m_xBuilder->get<Dialog>(id);
     std::unique_ptr<weld::Dialog> pRet(pDialog ? new 
SalInstanceDialog(pDialog, this, false)
                                                : nullptr);
-    if (bTakeOwnership && pDialog)
+    if (pDialog)
     {
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
         m_aOwnedToplevel.set(pDialog);
@@ -6570,13 +6568,12 @@ std::unique_ptr<weld::Dialog> 
SalInstanceBuilder::weld_dialog(const OString& id,
     return pRet;
 }
 
-std::unique_ptr<weld::Assistant> SalInstanceBuilder::weld_assistant(const 
OString& id,
-                                                                    bool 
bTakeOwnership)
+std::unique_ptr<weld::Assistant> SalInstanceBuilder::weld_assistant(const 
OString& id)
 {
     vcl::RoadmapWizard* pDialog = m_xBuilder->get<vcl::RoadmapWizard>(id);
     std::unique_ptr<weld::Assistant> pRet(pDialog ? new 
SalInstanceAssistant(pDialog, this, false)
                                                   : nullptr);
-    if (bTakeOwnership && pDialog)
+    if (pDialog)
     {
         assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
         m_aOwnedToplevel.set(pDialog);
@@ -6614,177 +6611,156 @@ std::unique_ptr<weld::Window> 
SalInstanceBuilder::create_screenshot_window()
     return std::unique_ptr<weld::Dialog>(new SalInstanceDialog(xDialog, this, 
false));
 }
 
-std::unique_ptr<weld::Widget> SalInstanceBuilder::weld_widget(const OString& 
id,
-                                                              bool 
bTakeOwnership)
+std::unique_ptr<weld::Widget> SalInstanceBuilder::weld_widget(const OString& 
id)
 {
     vcl::Window* pWidget = m_xBuilder->get(id);
-    return pWidget ? std::make_unique<SalInstanceWidget>(pWidget, this, 
bTakeOwnership) : nullptr;
+    return pWidget ? std::make_unique<SalInstanceWidget>(pWidget, this, false) 
: nullptr;
 }
 
-std::unique_ptr<weld::Container> SalInstanceBuilder::weld_container(const 
OString& id,
-                                                                    bool 
bTakeOwnership)
+std::unique_ptr<weld::Container> SalInstanceBuilder::weld_container(const 
OString& id)
 {
     vcl::Window* pContainer = m_xBuilder->get(id);
-    return pContainer ? std::make_unique<SalInstanceContainer>(pContainer, 
this, bTakeOwnership)
+    return pContainer ? std::make_unique<SalInstanceContainer>(pContainer, 
this, false)
                       : nullptr;
 }
 
-std::unique_ptr<weld::Box> SalInstanceBuilder::weld_box(const OString& id, 
bool bTakeOwnership)
+std::unique_ptr<weld::Box> SalInstanceBuilder::weld_box(const OString& id)
 {
     VclBox* pContainer = m_xBuilder->get<VclBox>(id);
-    return pContainer ? std::make_unique<SalInstanceBox>(pContainer, this, 
bTakeOwnership)
+    return pContainer ? std::make_unique<SalInstanceBox>(pContainer, this, 
false)
                       : nullptr;
 }
 
-std::unique_ptr<weld::Paned> SalInstanceBuilder::weld_paned(const OString& id,
-                                                            bool 
bTakeOwnership)
+std::unique_ptr<weld::Paned> SalInstanceBuilder::weld_paned(const OString& id)
 {
     VclPaned* pPaned = m_xBuilder->get<VclPaned>(id);
-    return pPaned ? std::make_unique<SalInstancePaned>(pPaned, this, 
bTakeOwnership)
+    return pPaned ? std::make_unique<SalInstancePaned>(pPaned, this, false)
                   : nullptr;
 }
 
-std::unique_ptr<weld::Frame> SalInstanceBuilder::weld_frame(const OString& id, 
bool bTakeOwnership)
+std::unique_ptr<weld::Frame> SalInstanceBuilder::weld_frame(const OString& id)
 {
     VclFrame* pFrame = m_xBuilder->get<VclFrame>(id);
     std::unique_ptr<weld::Frame> pRet(pFrame ? new SalInstanceFrame(pFrame, 
this, false) : nullptr);
-    if (bTakeOwnership && pFrame)
-    {
-        assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
-        m_aOwnedToplevel.set(pFrame);
-        m_xBuilder->drop_ownership(pFrame);
-    }
     return pRet;
 }
 
-std::unique_ptr<weld::ScrolledWindow> 
SalInstanceBuilder::weld_scrolled_window(const OString& id,
-                                                                               
bool bTakeOwnership)
+std::unique_ptr<weld::ScrolledWindow> 
SalInstanceBuilder::weld_scrolled_window(const OString& id)
 {
     VclScrolledWindow* pScrolledWindow = 
m_xBuilder->get<VclScrolledWindow>(id);
     return pScrolledWindow
-               ? std::make_unique<SalInstanceScrolledWindow>(pScrolledWindow, 
this, bTakeOwnership)
+               ? std::make_unique<SalInstanceScrolledWindow>(pScrolledWindow, 
this, false)
                : nullptr;
 }
 
-std::unique_ptr<weld::Notebook> SalInstanceBuilder::weld_notebook(const 
OString& id,
-                                                                  bool 
bTakeOwnership)
+std::unique_ptr<weld::Notebook> SalInstanceBuilder::weld_notebook(const 
OString& id)
 {
     vcl::Window* pNotebook = m_xBuilder->get(id);
     if (!pNotebook)
         return nullptr;
     if (pNotebook->GetType() == WindowType::TABCONTROL)
         return 
std::make_unique<SalInstanceNotebook>(static_cast<TabControl*>(pNotebook), this,
-                                                     bTakeOwnership);
+                                                     false);
     if (pNotebook->GetType() == WindowType::VERTICALTABCONTROL)
         return std::make_unique<SalInstanceVerticalNotebook>(
-            static_cast<VerticalTabControl*>(pNotebook), this, bTakeOwnership);
+            static_cast<VerticalTabControl*>(pNotebook), this, false);
     return nullptr;
 }
 
-std::unique_ptr<weld::Button> SalInstanceBuilder::weld_button(const OString& 
id,
-                                                              bool 
bTakeOwnership)
+std::unique_ptr<weld::Button> SalInstanceBuilder::weld_button(const OString& 
id)
 {
     Button* pButton = m_xBuilder->get<Button>(id);
-    return pButton ? std::make_unique<SalInstanceButton>(pButton, this, 
bTakeOwnership) : nullptr;
+    return pButton ? std::make_unique<SalInstanceButton>(pButton, this, false) 
: nullptr;
 }
 
-std::unique_ptr<weld::MenuButton> SalInstanceBuilder::weld_menu_button(const 
OString& id,
-                                                                       bool 
bTakeOwnership)
+std::unique_ptr<weld::MenuButton> SalInstanceBuilder::weld_menu_button(const 
OString& id)
 {
     MenuButton* pButton = m_xBuilder->get<MenuButton>(id);
-    return pButton ? std::make_unique<SalInstanceMenuButton>(pButton, this, 
bTakeOwnership)
+    return pButton ? std::make_unique<SalInstanceMenuButton>(pButton, this, 
false)
                    : nullptr;
 }
 
-std::unique_ptr<weld::LinkButton> SalInstanceBuilder::weld_link_button(const 
OString& id,
-                                                                       bool 
bTakeOwnership)
+std::unique_ptr<weld::LinkButton> SalInstanceBuilder::weld_link_button(const 
OString& id)
 {
     FixedHyperlink* pButton = m_xBuilder->get<FixedHyperlink>(id);
-    return pButton ? std::make_unique<SalInstanceLinkButton>(pButton, this, 
bTakeOwnership)
+    return pButton ? std::make_unique<SalInstanceLinkButton>(pButton, this, 
false)
                    : nullptr;
 }
 
-std::unique_ptr<weld::ToggleButton> 
SalInstanceBuilder::weld_toggle_button(const OString& id,
-                                                                           
bool bTakeOwnership)
+std::unique_ptr<weld::ToggleButton> 
SalInstanceBuilder::weld_toggle_button(const OString& id)
 {
     PushButton* pToggleButton = m_xBuilder->get<PushButton>(id);
     return pToggleButton
-               ? std::make_unique<SalInstanceToggleButton>(pToggleButton, 
this, bTakeOwnership)
+               ? std::make_unique<SalInstanceToggleButton>(pToggleButton, 
this, false)
                : nullptr;
 }
 
-std::unique_ptr<weld::RadioButton> SalInstanceBuilder::weld_radio_button(const 
OString& id,
-                                                                         bool 
bTakeOwnership)
+std::unique_ptr<weld::RadioButton> SalInstanceBuilder::weld_radio_button(const 
OString& id)
 {
     RadioButton* pRadioButton = m_xBuilder->get<RadioButton>(id);
     return pRadioButton
-               ? std::make_unique<SalInstanceRadioButton>(pRadioButton, this, 
bTakeOwnership)
+               ? std::make_unique<SalInstanceRadioButton>(pRadioButton, this, 
false)
                : nullptr;
 }
 
-std::unique_ptr<weld::CheckButton> SalInstanceBuilder::weld_check_button(const 
OString& id,
-                                                                         bool 
bTakeOwnership)
+std::unique_ptr<weld::CheckButton> SalInstanceBuilder::weld_check_button(const 
OString& id)
 {
     CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id);
     return pCheckButton
-               ? std::make_unique<SalInstanceCheckButton>(pCheckButton, this, 
bTakeOwnership)
+               ? std::make_unique<SalInstanceCheckButton>(pCheckButton, this, 
false)
                : nullptr;
 }
 
-std::unique_ptr<weld::Scale> SalInstanceBuilder::weld_scale(const OString& id, 
bool bTakeOwnership)
+std::unique_ptr<weld::Scale> SalInstanceBuilder::weld_scale(const OString& id)
 {
     Slider* pSlider = m_xBuilder->get<Slider>(id);
-    return pSlider ? std::make_unique<SalInstanceScale>(pSlider, this, 
bTakeOwnership) : nullptr;
+    return pSlider ? std::make_unique<SalInstanceScale>(pSlider, this, false) 
: nullptr;
 }
 
-std::unique_ptr<weld::ProgressBar> SalInstanceBuilder::weld_progress_bar(const 
OString& id,
-                                                                         bool 
bTakeOwnership)
+std::unique_ptr<weld::ProgressBar> SalInstanceBuilder::weld_progress_bar(const 
OString& id)
 {
     ::ProgressBar* pProgress = m_xBuilder->get<::ProgressBar>(id);
-    return pProgress ? std::make_unique<SalInstanceProgressBar>(pProgress, 
this, bTakeOwnership)
+    return pProgress ? std::make_unique<SalInstanceProgressBar>(pProgress, 
this, false)
                      : nullptr;
 }
 
-std::unique_ptr<weld::Spinner> SalInstanceBuilder::weld_spinner(const OString& 
id,
-                                                                bool 
bTakeOwnership)
+std::unique_ptr<weld::Spinner> SalInstanceBuilder::weld_spinner(const OString& 
id)
 {
     Throbber* pThrobber = m_xBuilder->get<Throbber>(id);
-    return pThrobber ? std::make_unique<SalInstanceSpinner>(pThrobber, this, 
bTakeOwnership)
+    return pThrobber ? std::make_unique<SalInstanceSpinner>(pThrobber, this, 
false)
                      : nullptr;
 }
 
-std::unique_ptr<weld::Image> SalInstanceBuilder::weld_image(const OString& id, 
bool bTakeOwnership)
+std::unique_ptr<weld::Image> SalInstanceBuilder::weld_image(const OString& id)
 {
     FixedImage* pImage = m_xBuilder->get<FixedImage>(id);
-    return pImage ? std::make_unique<SalInstanceImage>(pImage, this, 
bTakeOwnership) : nullptr;
+    return pImage ? std::make_unique<SalInstanceImage>(pImage, this, false) : 
nullptr;
 }
 
-std::unique_ptr<weld::Calendar> SalInstanceBuilder::weld_calendar(const 
OString& id,
-                                                                  bool 
bTakeOwnership)
+std::unique_ptr<weld::Calendar> SalInstanceBuilder::weld_calendar(const 
OString& id)
 {
     Calendar* pCalendar = m_xBuilder->get<Calendar>(id);
-    return pCalendar ? std::make_unique<SalInstanceCalendar>(pCalendar, this, 
bTakeOwnership)
+    return pCalendar ? std::make_unique<SalInstanceCalendar>(pCalendar, this, 
false)
                      : nullptr;
 }
 
-std::unique_ptr<weld::Entry> SalInstanceBuilder::weld_entry(const OString& id, 
bool bTakeOwnership)
+std::unique_ptr<weld::Entry> SalInstanceBuilder::weld_entry(const OString& id)
 {
     Edit* pEntry = m_xBuilder->get<Edit>(id);
-    return pEntry ? std::make_unique<SalInstanceEntry>(pEntry, this, 
bTakeOwnership) : nullptr;
+    return pEntry ? std::make_unique<SalInstanceEntry>(pEntry, this, false) : 
nullptr;
 }
 
-std::unique_ptr<weld::SpinButton> SalInstanceBuilder::weld_spin_button(const 
OString& id,
-                                                                       bool 
bTakeOwnership)
+std::unique_ptr<weld::SpinButton> SalInstanceBuilder::weld_spin_button(const 
OString& id)
 {
     FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id);
-    return pSpinButton ? std::make_unique<SalInstanceSpinButton>(pSpinButton, 
this, bTakeOwnership)
+    return pSpinButton ? std::make_unique<SalInstanceSpinButton>(pSpinButton, 
this, false)
                        : nullptr;
 }
 
 std::unique_ptr<weld::MetricSpinButton>
-SalInstanceBuilder::weld_metric_spin_button(const OString& id, FieldUnit 
eUnit, bool bTakeOwnership)
+SalInstanceBuilder::weld_metric_spin_button(const OString& id, FieldUnit eUnit)
 {
-    std::unique_ptr<weld::SpinButton> xButton(weld_spin_button(id, 
bTakeOwnership));
+    std::unique_ptr<weld::SpinButton> xButton(weld_spin_button(id));
     if (xButton)
     {
         SalInstanceSpinButton& rButton = 
dynamic_cast<SalInstanceSpinButton&>(*xButton);
@@ -6794,99 +6770,92 @@ SalInstanceBuilder::weld_metric_spin_button(const 
OString& id, FieldUnit eUnit,
 }
 
 std::unique_ptr<weld::FormattedSpinButton>
-SalInstanceBuilder::weld_formatted_spin_button(const OString& id, bool 
bTakeOwnership)
+SalInstanceBuilder::weld_formatted_spin_button(const OString& id)
 {
     FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id);
     return pSpinButton
-               ? std::make_unique<SalInstanceFormattedSpinButton>(pSpinButton, 
this, bTakeOwnership)
+               ? std::make_unique<SalInstanceFormattedSpinButton>(pSpinButton, 
this, false)
                : nullptr;
 }
 
-std::unique_ptr<weld::ComboBox> SalInstanceBuilder::weld_combo_box(const 
OString& id,
-                                                                   bool 
bTakeOwnership)
+std::unique_ptr<weld::ComboBox> SalInstanceBuilder::weld_combo_box(const 
OString& id)
 {
     vcl::Window* pWidget = m_xBuilder->get(id);
     ::ComboBox* pComboBox = dynamic_cast<::ComboBox*>(pWidget);
     if (pComboBox)
-        return std::make_unique<SalInstanceComboBoxWithEdit>(pComboBox, this, 
bTakeOwnership);
+        return std::make_unique<SalInstanceComboBoxWithEdit>(pComboBox, this, 
false);
     ListBox* pListBox = dynamic_cast<ListBox*>(pWidget);
     return pListBox
-               ? std::make_unique<SalInstanceComboBoxWithoutEdit>(pListBox, 
this, bTakeOwnership)
+               ? std::make_unique<SalInstanceComboBoxWithoutEdit>(pListBox, 
this, false)
                : nullptr;
 }
 
 std::unique_ptr<weld::EntryTreeView>
 SalInstanceBuilder::weld_entry_tree_view(const OString& containerid, const 
OString& entryid,
-                                         const OString& treeviewid, bool 
bTakeOwnership)
+                                         const OString& treeviewid)
 {
     vcl::Window* pContainer = m_xBuilder->get(containerid);
     return pContainer ? std::make_unique<SalInstanceEntryTreeView>(
-                            pContainer, this, bTakeOwnership, 
weld_entry(entryid, bTakeOwnership),
-                            weld_tree_view(treeviewid, bTakeOwnership))
+                            pContainer, this, false, weld_entry(entryid),
+                            weld_tree_view(treeviewid))
                       : nullptr;
 }
 
-std::unique_ptr<weld::TreeView> SalInstanceBuilder::weld_tree_view(const 
OString& id,
-                                                                   bool 
bTakeOwnership)
+std::unique_ptr<weld::TreeView> SalInstanceBuilder::weld_tree_view(const 
OString& id)
 {
     SvTabListBox* pTreeView = m_xBuilder->get<SvTabListBox>(id);
-    return pTreeView ? std::make_unique<SalInstanceTreeView>(pTreeView, this, 
bTakeOwnership)
+    return pTreeView ? std::make_unique<SalInstanceTreeView>(pTreeView, this, 
false)
                      : nullptr;
 }
 
-std::unique_ptr<weld::IconView> SalInstanceBuilder::weld_icon_view(const 
OString& id,
-                                                                   bool 
bTakeOwnership)
+std::unique_ptr<weld::IconView> SalInstanceBuilder::weld_icon_view(const 
OString& id)
 {
     IconView* pIconView = m_xBuilder->get<IconView>(id);
-    return pIconView ? std::make_unique<SalInstanceIconView>(pIconView, this, 
bTakeOwnership)
+    return pIconView ? std::make_unique<SalInstanceIconView>(pIconView, this, 
false)
                      : nullptr;
 }
 
-std::unique_ptr<weld::Label> SalInstanceBuilder::weld_label(const OString& id, 
bool bTakeOwnership)
+std::unique_ptr<weld::Label> SalInstanceBuilder::weld_label(const OString& id)
 {
     Control* pLabel = m_xBuilder->get<Control>(id);
-    return pLabel ? std::make_unique<SalInstanceLabel>(pLabel, this, 
bTakeOwnership) : nullptr;
+    return pLabel ? std::make_unique<SalInstanceLabel>(pLabel, this, false) : 
nullptr;
 }
 
-std::unique_ptr<weld::TextView> SalInstanceBuilder::weld_text_view(const 
OString& id,
-                                                                   bool 
bTakeOwnership)
+std::unique_ptr<weld::TextView> SalInstanceBuilder::weld_text_view(const 
OString& id)
 {
     VclMultiLineEdit* pTextView = m_xBuilder->get<VclMultiLineEdit>(id);
-    return pTextView ? std::make_unique<SalInstanceTextView>(pTextView, this, 
bTakeOwnership)
+    return pTextView ? std::make_unique<SalInstanceTextView>(pTextView, this, 
false)
                      : nullptr;
 }
 
-std::unique_ptr<weld::Expander> SalInstanceBuilder::weld_expander(const 
OString& id,
-                                                                  bool 
bTakeOwnership)
+std::unique_ptr<weld::Expander> SalInstanceBuilder::weld_expander(const 
OString& id)
 {
     VclExpander* pExpander = m_xBuilder->get<VclExpander>(id);
-    return pExpander ? std::make_unique<SalInstanceExpander>(pExpander, this, 
bTakeOwnership)
+    return pExpander ? std::make_unique<SalInstanceExpander>(pExpander, this, 
false)
                      : nullptr;
 }
 
 std::unique_ptr<weld::DrawingArea>
 SalInstanceBuilder::weld_drawing_area(const OString& id, const a11yref& 
rA11yImpl,
-                                      FactoryFunction pUITestFactoryFunction, 
void* pUserData,
-                                      bool bTakeOwnership)
+                                      FactoryFunction pUITestFactoryFunction, 
void* pUserData)
 {
     VclDrawingArea* pDrawingArea = m_xBuilder->get<VclDrawingArea>(id);
     return pDrawingArea ? 
std::make_unique<SalInstanceDrawingArea>(pDrawingArea, this, rA11yImpl,
                                                                    
pUITestFactoryFunction,
-                                                                   pUserData, 
bTakeOwnership)
+                                                                   pUserData, 
false)
                         : nullptr;
 }
 
-std::unique_ptr<weld::Menu> SalInstanceBuilder::weld_menu(const OString& id, 
bool bTakeOwnership)
+std::unique_ptr<weld::Menu> SalInstanceBuilder::weld_menu(const OString& id)
 {
     PopupMenu* pMenu = m_xBuilder->get_menu(id);
-    return pMenu ? std::make_unique<SalInstanceMenu>(pMenu, bTakeOwnership) : 
nullptr;
+    return pMenu ? std::make_unique<SalInstanceMenu>(pMenu, true) : nullptr;
 }
 
-std::unique_ptr<weld::Toolbar> SalInstanceBuilder::weld_toolbar(const OString& 
id,
-                                                                bool 
bTakeOwnership)
+std::unique_ptr<weld::Toolbar> SalInstanceBuilder::weld_toolbar(const OString& 
id)
 {
     ToolBox* pToolBox = m_xBuilder->get<ToolBox>(id);
-    return pToolBox ? std::make_unique<SalInstanceToolbar>(pToolBox, this, 
bTakeOwnership)
+    return pToolBox ? std::make_unique<SalInstanceToolbar>(pToolBox, this, 
false)
                     : nullptr;
 }
 
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8404a7f7dff1..0a1366ab4996 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -16242,7 +16242,7 @@ public:
         OString sPageHelpId;
         // check to see if there is a notebook called tabcontrol and get the
         // helpid for the current page of that
-        std::unique_ptr<weld::Notebook> xNotebook(weld_notebook("tabcontrol", 
false));
+        std::unique_ptr<weld::Notebook> xNotebook(weld_notebook("tabcontrol"));
         if (xNotebook)
         {
             if (GtkInstanceContainer* pPage = 
dynamic_cast<GtkInstanceContainer*>(xNotebook->get_page(xNotebook->get_current_page_ident())))
@@ -16278,33 +16278,33 @@ public:
             gtk_container_add(GTK_CONTAINER(m_pParentWidget), pWidget);
     }
 
-    virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const 
OString &id, bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const 
OString &id) override
     {
         GtkMessageDialog* pMessageDialog = 
GTK_MESSAGE_DIALOG(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pMessageDialog)
             return nullptr;
         gtk_window_set_transient_for(GTK_WINDOW(pMessageDialog), 
GTK_WINDOW(gtk_widget_get_toplevel(m_pParentWidget)));
-        return std::make_unique<GtkInstanceMessageDialog>(pMessageDialog, 
this, bTakeOwnership);
+        return std::make_unique<GtkInstanceMessageDialog>(pMessageDialog, 
this, true);
     }
 
-    virtual std::unique_ptr<weld::Assistant> weld_assistant(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::Assistant> weld_assistant(const OString &id) 
override
     {
         GtkAssistant* pAssistant = 
GTK_ASSISTANT(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pAssistant)
             return nullptr;
         if (m_pParentWidget)
             gtk_window_set_transient_for(GTK_WINDOW(pAssistant), 
GTK_WINDOW(gtk_widget_get_toplevel(m_pParentWidget)));
-        return std::make_unique<GtkInstanceAssistant>(pAssistant, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceAssistant>(pAssistant, this, true);
     }
 
-    virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString &id) 
override
     {
         GtkWindow* pDialog = GTK_WINDOW(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pDialog)
             return nullptr;
         if (m_pParentWidget)
             gtk_window_set_transient_for(pDialog, 
GTK_WINDOW(gtk_widget_get_toplevel(m_pParentWidget)));
-        return std::make_unique<GtkInstanceDialog>(pDialog, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceDialog>(pDialog, this, true);
     }
 
     virtual std::unique_ptr<weld::Window> create_screenshot_window() override
@@ -16345,202 +16345,201 @@ public:
         return std::make_unique<GtkInstanceDialog>(pDialog, this, true);
     }
 
-    virtual std::unique_ptr<weld::Widget> weld_widget(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Widget> weld_widget(const OString &id) 
override
     {
         GtkWidget* pWidget = GTK_WIDGET(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pWidget)
             return nullptr;
         auto_add_parentless_widgets_to_container(pWidget);
-        return std::make_unique<GtkInstanceWidget>(pWidget, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceWidget>(pWidget, this, false);
     }
 
-    virtual std::unique_ptr<weld::Container> weld_container(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::Container> weld_container(const OString &id) 
override
     {
         GtkContainer* pContainer = 
GTK_CONTAINER(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pContainer)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pContainer));
-        return std::make_unique<GtkInstanceContainer>(pContainer, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceContainer>(pContainer, this, false);
     }
 
-    virtual std::unique_ptr<weld::Box> weld_box(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Box> weld_box(const OString &id) override
     {
         GtkBox* pBox = GTK_BOX(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pBox)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pBox));
-        return std::make_unique<GtkInstanceBox>(pBox, this, bTakeOwnership);
+        return std::make_unique<GtkInstanceBox>(pBox, this, false);
     }
 
-    virtual std::unique_ptr<weld::Paned> weld_paned(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Paned> weld_paned(const OString &id) override
     {
         GtkPaned* pPaned = GTK_PANED(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pPaned)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pPaned));
-        return std::make_unique<GtkInstancePaned>(pPaned, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstancePaned>(pPaned, this, false);
     }
 
-    virtual std::unique_ptr<weld::Frame> weld_frame(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Frame> weld_frame(const OString &id) override
     {
         GtkFrame* pFrame = GTK_FRAME(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pFrame)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pFrame));
-        return std::make_unique<GtkInstanceFrame>(pFrame, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceFrame>(pFrame, this, false);
     }
 
-    virtual std::unique_ptr<weld::ScrolledWindow> weld_scrolled_window(const 
OString &id, bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::ScrolledWindow> weld_scrolled_window(const 
OString &id) override
     {
         GtkScrolledWindow* pScrolledWindow = 
GTK_SCROLLED_WINDOW(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pScrolledWindow)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pScrolledWindow));
-        return std::make_unique<GtkInstanceScrolledWindow>(pScrolledWindow, 
this, bTakeOwnership);
+        return std::make_unique<GtkInstanceScrolledWindow>(pScrolledWindow, 
this, false);
     }
 
-    virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString &id) 
override
     {
         GtkNotebook* pNotebook = 
GTK_NOTEBOOK(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pNotebook)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pNotebook));
-        return std::make_unique<GtkInstanceNotebook>(pNotebook, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceNotebook>(pNotebook, this, false);
     }
 
-    virtual std::unique_ptr<weld::Button> weld_button(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Button> weld_button(const OString &id) 
override
     {
         GtkButton* pButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pButton)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton));
-        return std::make_unique<GtkInstanceButton>(pButton, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceButton>(pButton, this, false);
     }
 
-    virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OString 
&id, bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OString 
&id) override
     {
         GtkMenuButton* pButton = 
GTK_MENU_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pButton)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton));
-        return std::make_unique<GtkInstanceMenuButton>(pButton, nullptr, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceMenuButton>(pButton, nullptr, this, 
false);
     }
 
-    virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OString 
&id, bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OString 
&id) override
     {
         GtkLinkButton* pButton = 
GTK_LINK_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pButton)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton));
-        return std::make_unique<GtkInstanceLinkButton>(pButton, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceLinkButton>(pButton, this, false);
     }
 
-    virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const 
OString &id, bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const 
OString &id) override
     {
         GtkToggleButton* pToggleButton = 
GTK_TOGGLE_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pToggleButton)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pToggleButton));
-        return std::make_unique<GtkInstanceToggleButton>(pToggleButton, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceToggleButton>(pToggleButton, this, 
false);
     }
 
-    virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OString 
&id, bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OString 
&id) override
     {
         GtkRadioButton* pRadioButton = 
GTK_RADIO_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pRadioButton)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pRadioButton));
-        return std::make_unique<GtkInstanceRadioButton>(pRadioButton, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceRadioButton>(pRadioButton, this, 
false);
     }
 
-    virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OString 
&id, bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OString 
&id) override
     {
         GtkCheckButton* pCheckButton = 
GTK_CHECK_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pCheckButton)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pCheckButton));
-        return std::make_unique<GtkInstanceCheckButton>(pCheckButton, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceCheckButton>(pCheckButton, this, 
false);
     }
 
-    virtual std::unique_ptr<weld::Scale> weld_scale(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Scale> weld_scale(const OString &id) override
     {
         GtkScale* pScale = GTK_SCALE(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pScale)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pScale));
-        return std::make_unique<GtkInstanceScale>(pScale, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceScale>(pScale, this, false);
     }
 
-    virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const OString 
&id, bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const OString 
&id) override
     {
         GtkProgressBar* pProgressBar = 
GTK_PROGRESS_BAR(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pProgressBar)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pProgressBar));
-        return std::make_unique<GtkInstanceProgressBar>(pProgressBar, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceProgressBar>(pProgressBar, this, 
false);
     }
 
-    virtual std::unique_ptr<weld::Spinner> weld_spinner(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::Spinner> weld_spinner(const OString &id) 
override
     {
         GtkSpinner* pSpinner = GTK_SPINNER(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pSpinner)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pSpinner));
-        return std::make_unique<GtkInstanceSpinner>(pSpinner, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceSpinner>(pSpinner, this, false);
     }
 
-    virtual std::unique_ptr<weld::Image> weld_image(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Image> weld_image(const OString &id) override
     {
         GtkImage* pImage = GTK_IMAGE(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pImage)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pImage));
-        return std::make_unique<GtkInstanceImage>(pImage, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceImage>(pImage, this, false);
     }
 
-    virtual std::unique_ptr<weld::Calendar> weld_calendar(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::Calendar> weld_calendar(const OString &id) 
override
     {
         GtkCalendar* pCalendar = 
GTK_CALENDAR(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pCalendar)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pCalendar));
-        return std::make_unique<GtkInstanceCalendar>(pCalendar, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceCalendar>(pCalendar, this, false);
     }
 
-    virtual std::unique_ptr<weld::Entry> weld_entry(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Entry> weld_entry(const OString &id) override
     {
         GtkEntry* pEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pEntry)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pEntry));
-        return std::make_unique<GtkInstanceEntry>(pEntry, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceEntry>(pEntry, this, false);
     }
 
-    virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString 
&id, bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString 
&id) override
     {
         GtkSpinButton* pSpinButton = 
GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pSpinButton)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pSpinButton));
-        return std::make_unique<GtkInstanceSpinButton>(pSpinButton, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceSpinButton>(pSpinButton, this, 
false);
     }
 
-    virtual std::unique_ptr<weld::MetricSpinButton> 
weld_metric_spin_button(const OString& id, FieldUnit eUnit,
-                                                                      bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::MetricSpinButton> 
weld_metric_spin_button(const OString& id, FieldUnit eUnit) override
     {
-        return std::make_unique<weld::MetricSpinButton>(weld_spin_button(id, 
bTakeOwnership), eUnit);
+        return std::make_unique<weld::MetricSpinButton>(weld_spin_button(id), 
eUnit);
     }
 
-    virtual std::unique_ptr<weld::FormattedSpinButton> 
weld_formatted_spin_button(const OString &id, bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::FormattedSpinButton> 
weld_formatted_spin_button(const OString &id) override
     {
         GtkSpinButton* pSpinButton = 
GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pSpinButton)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pSpinButton));
-        return std::make_unique<GtkInstanceFormattedSpinButton>(pSpinButton, 
this, bTakeOwnership);
+        return std::make_unique<GtkInstanceFormattedSpinButton>(pSpinButton, 
this, false);
     }
 
-    virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString &id) 
override
     {
         GtkComboBox* pComboBox = 
GTK_COMBO_BOX(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pComboBox)
@@ -16575,90 +16574,90 @@ public:
               super tall menu doesn't appear under X sometimes
         */
         GtkBuilder* pComboBuilder = makeComboBoxBuilder();
-        return std::make_unique<GtkInstanceComboBox>(pComboBuilder, pComboBox, 
this, bTakeOwnership);
+        return std::make_unique<GtkInstanceComboBox>(pComboBuilder, pComboBox, 
this, false);
     }
 
-    virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString &id) 
override
     {
         GtkTreeView* pTreeView = 
GTK_TREE_VIEW(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pTreeView)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pTreeView));
-        return std::make_unique<GtkInstanceTreeView>(pTreeView, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceTreeView>(pTreeView, this, false);
     }
 
-    virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString &id) 
override
     {
         GtkIconView* pIconView = 
GTK_ICON_VIEW(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pIconView)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pIconView));
-        return std::make_unique<GtkInstanceIconView>(pIconView, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceIconView>(pIconView, this, false);
     }
 
-    virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const 
OString& containerid, const OString& entryid, const OString& treeviewid, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const 
OString& containerid, const OString& entryid, const OString& treeviewid) 
override
     {
         GtkContainer* pContainer = 
GTK_CONTAINER(gtk_builder_get_object(m_pBuilder, containerid.getStr()));
         if (!pContainer)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pContainer));
-        return std::make_unique<GtkInstanceEntryTreeView>(pContainer, this, 
bTakeOwnership,
-                                                          weld_entry(entryid, 
bTakeOwnership),
-                                                          
weld_tree_view(treeviewid, bTakeOwnership));
+        return std::make_unique<GtkInstanceEntryTreeView>(pContainer, this, 
false,
+                                                          weld_entry(entryid),
+                                                          
weld_tree_view(treeviewid));
     }
 
-    virtual std::unique_ptr<weld::Label> weld_label(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Label> weld_label(const OString &id) override
     {
         GtkLabel* pLabel = GTK_LABEL(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pLabel)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pLabel));
-        return std::make_unique<GtkInstanceLabel>(pLabel, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceLabel>(pLabel, this, false);
     }
 
-    virtual std::unique_ptr<weld::TextView> weld_text_view(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::TextView> weld_text_view(const OString &id) 
override
     {
         GtkTextView* pTextView = 
GTK_TEXT_VIEW(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pTextView)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pTextView));
-        return std::make_unique<GtkInstanceTextView>(pTextView, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceTextView>(pTextView, this, false);
     }
 
-    virtual std::unique_ptr<weld::Expander> weld_expander(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::Expander> weld_expander(const OString &id) 
override
     {
         GtkExpander* pExpander = 
GTK_EXPANDER(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pExpander)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pExpander));
-        return std::make_unique<GtkInstanceExpander>(pExpander, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceExpander>(pExpander, this, false);
     }
 
     virtual std::unique_ptr<weld::DrawingArea> weld_drawing_area(const OString 
&id, const a11yref& rA11y,
-            FactoryFunction /*pUITestFactoryFunction*/, void* /*pUserData*/, 
bool bTakeOwnership) override
+            FactoryFunction /*pUITestFactoryFunction*/, void* /*pUserData*/) 
override
     {
         GtkDrawingArea* pDrawingArea = 
GTK_DRAWING_AREA(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pDrawingArea)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pDrawingArea));
-        return std::make_unique<GtkInstanceDrawingArea>(pDrawingArea, this, 
rA11y, bTakeOwnership);
+        return std::make_unique<GtkInstanceDrawingArea>(pDrawingArea, this, 
rA11y, false);
     }
 
-    virtual std::unique_ptr<weld::Menu> weld_menu(const OString &id, bool 
bTakeOwnership) override
+    virtual std::unique_ptr<weld::Menu> weld_menu(const OString &id) override
     {
         GtkMenu* pMenu = GTK_MENU(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pMenu)
             return nullptr;
-        return std::make_unique<GtkInstanceMenu>(pMenu, bTakeOwnership);
+        return std::make_unique<GtkInstanceMenu>(pMenu, true);
     }
 
-    virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString &id, 
bool bTakeOwnership) override
+    virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString &id) 
override
     {
         GtkToolbar* pToolbar = GTK_TOOLBAR(gtk_builder_get_object(m_pBuilder, 
id.getStr()));
         if (!pToolbar)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pToolbar));
-        return std::make_unique<GtkInstanceToolbar>(pToolbar, this, 
bTakeOwnership);
+        return std::make_unique<GtkInstanceToolbar>(pToolbar, this, false);
     }
 
     virtual std::unique_ptr<weld::SizeGroup> create_size_group() override
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to