vcl/unx/gtk3/gtk3gtkinst.cxx |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

New commits:
commit a24b27986dfedd4566cf4081090bac8bd2f63e2a
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon May 11 09:35:42 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon May 11 16:45:13 2020 +0200

    split and rename to form insertAsParent
    
    for clarity as to what each chunk does
    
    Change-Id: Ia58d19dfe162631d0ba67975eb2b9546d7afa2cb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93952
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8cb8d0c71823..7e05280bbc46 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1710,13 +1710,13 @@ namespace
     }
 #endif
 
-    void insertParent(GtkWidget* pWidget, GtkWidget* pReplacement)
+    void replaceWidget(GtkWidget* pWidget, GtkWidget* pReplacement)
     {
+        g_object_ref(pWidget);
+
         // remove the widget and replace it with pReplacement
         GtkWidget* pParent = gtk_widget_get_parent(pWidget);
 
-        g_object_ref(pWidget);
-
         gint nTopAttach(0), nLeftAttach(0), nHeight(1), nWidth(1);
         if (GTK_IS_GRID(pParent))
         {
@@ -1794,6 +1794,15 @@ namespace
         gtk_widget_set_halign(pReplacement, gtk_widget_get_halign(pWidget));
         gtk_widget_set_valign(pReplacement, gtk_widget_get_valign(pWidget));
 
+        g_object_unref(pWidget);
+    }
+
+    void insertAsParent(GtkWidget* pWidget, GtkWidget* pReplacement)
+    {
+        g_object_ref(pWidget);
+
+        replaceWidget(pWidget, pReplacement);
+
         gtk_container_add(GTK_CONTAINER(pReplacement), pWidget);
 
         g_object_unref(pWidget);
@@ -1817,7 +1826,7 @@ namespace
             pMouseEventBox = gtk_event_box_new();
             gtk_event_box_set_above_child(GTK_EVENT_BOX(pMouseEventBox), 
false);
             gtk_event_box_set_visible_window(GTK_EVENT_BOX(pMouseEventBox), 
false);
-            insertParent(pWidget, pMouseEventBox);
+            insertAsParent(pWidget, pMouseEventBox);
         }
 
         return pMouseEventBox;
@@ -13687,7 +13696,7 @@ public:
         , m_nMRUCount(0)
         , m_nMaxMRUCount(0)
     {
-        insertParent(GTK_WIDGET(m_pComboBox), GTK_WIDGET(getContainer()));
+        insertAsParent(GTK_WIDGET(m_pComboBox), GTK_WIDGET(getContainer()));
         gtk_widget_set_visible(GTK_WIDGET(m_pComboBox), false);
         gtk_widget_set_no_show_all(GTK_WIDGET(m_pComboBox), true);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to