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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 6 16:27:16 UTC 2020


 vcl/unx/gtk3/gtk3gtkinst.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit b5d1c3c8519308d610a37e29eea300ad654cd371
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 6 12:42:35 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 6 17:26:39 2020 +0100

    don't set labels/icon if the toolitem isn't a button
    
    Change-Id: I48cd752e72e2c9fb92713343d9b3447817b10728
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90105
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index bf480535ec8e..10ddc6612ec9 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7699,12 +7699,16 @@ public:
     virtual void set_item_label(int nIndex, const OUString& rLabel) override
     {
         GtkToolItem* pItem = gtk_toolbar_get_nth_item(m_pToolbar, nIndex);
+        if (!GTK_IS_TOOL_BUTTON(pItem))
+            return;
         gtk_tool_button_set_label(GTK_TOOL_BUTTON(pItem), MapToGtkAccelerator(rLabel).getStr());
     }
 
     virtual void set_item_label(const OString& rIdent, const OUString& rLabel) override
     {
         GtkToolButton* pItem = m_aMap[rIdent];
+        if (!pItem)
+            return;
         gtk_tool_button_set_label(GTK_TOOL_BUTTON(pItem), MapToGtkAccelerator(rLabel).getStr());
     }
 
@@ -7717,6 +7721,8 @@ public:
     virtual void set_item_icon_name(const OString& rIdent, const OUString& rIconName) override
     {
         GtkToolButton* pItem = m_aMap[rIdent];
+        if (!pItem)
+            return;
 
         GtkWidget* pImage = nullptr;
 
@@ -7733,18 +7739,24 @@ public:
     virtual void set_item_image(const OString& rIdent, const css::uno::Reference<css::graphic::XGraphic>& rIcon) override
     {
         GtkToolButton* pItem = m_aMap[rIdent];
+        if (!pItem)
+            return;
         set_item_image(pItem, rIcon);
     }
 
     virtual void set_item_image(const OString& rIdent, VirtualDevice* pDevice) override
     {
         GtkToolButton* pItem = m_aMap[rIdent];
+        if (!pItem)
+            return;
         set_item_image(pItem, pDevice);
     }
 
     virtual void set_item_image(int nIndex, const css::uno::Reference<css::graphic::XGraphic>& rIcon) override
     {
         GtkToolItem* pItem = gtk_toolbar_get_nth_item(m_pToolbar, nIndex);
+        if (!GTK_IS_TOOL_BUTTON(pItem))
+            return;
         set_item_image(GTK_TOOL_BUTTON(pItem), rIcon);
     }
 


More information about the Libreoffice-commits mailing list