vcl/unx/gtk3/gtkinst.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 4b06f0e7e280eafbb2d2cfc1d9f2d26823dfe0b6
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Mar 21 23:49:00 2025 -0700
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Mar 22 16:59:32 2025 +0100

    gtk3: Fix another memleak in GtkInstanceBuilder::postprocess_widget
    
    Fixes this memory leak reported by valgrind:
    
        ==502039== 48 bytes in 2 blocks are definitely lost in loss record 
10,090 of 19,684
        ==502039==    at 0x4844818: malloc (in 
/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
        ==502039==    by 0x1306B2C1: g_malloc (in 
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.8400.0)
        ==502039==    by 0x13087E72: g_strdup (in 
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.8400.0)
        ==502039==    by 0x12FE6D7A: ??? (in 
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.8400.0)
        ==502039==    by 0x12FC58BB: g_object_get_valist (in 
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.8400.0)
        ==502039==    by 0x12FC5DB4: g_object_get (in 
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.8400.0)
        ==502039==    by 0x18C7A79D: gtk_widget_get_tooltip_text (in 
/usr/lib/x86_64-linux-gnu/libgtk-3.so.0.2417.32)
        ==502039==    by 0x186F2A7E: (anonymous 
namespace)::GtkInstanceBuilder::postprocess_widget(_GtkWidget*) 
(gtkinst.cxx:24148)
        ==502039==    by 0x186ECCC0: (anonymous 
namespace)::GtkInstanceBuilder::postprocess(void*, void*) (gtkinst.cxx:24343)
        ==502039==    by 0x1308714F: g_slist_foreach (in 
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.8400.0)
        ==502039==    by 0x186EC43D: (anonymous 
namespace)::GtkInstanceBuilder::GtkInstanceBuilder(_GtkWidget*, 
std::basic_string_view<char16_t, std::char_traits<char16_t> >, rtl::OUString 
const&, SystemChildWindow*, bool)
    
    Change-Id: I0cecc055c1b3ae5e7429b60f4a68618f644ed29a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183217
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 989f51996b22..b2c6600f8b54 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -24145,7 +24145,8 @@ private:
             }
 
             // if no tooltip reuse the label as default tooltip
-            if (!gtk_widget_get_tooltip_text(pWidget))
+            g_autofree char* pTooltipText = 
gtk_widget_get_tooltip_text(pWidget);
+            if (!pTooltipText)
             {
                 if (const gchar* label = 
gtk_tool_button_get_label(pToolButton))
                     gtk_widget_set_tooltip_text(pWidget, label);

Reply via email to