Subject: Re: bug#75636: GTK memory leaks
From: Pip Cet <[email-masked]>
To: Po Lu <[email-masked]>
Cc: [email-masked]
Date: Sat, 01 Feb 2025 23:31:19 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Pip Cet <[email-masked]> writes:

> "Po Lu" <[email-masked]> writes:
>
>>> commit 5ed4aaa986dbf75f8565f4d8cdd3d1d1b38b6142 (HEAD)
>>> Author: Pip Cet <[email-masked]>
>>>
>>>     Destroy GTK tool bar widget if it was never attached (bug#75636)
>>>
>>>     * src/gtkutil.c (xg_free_frame_widgets): Call gtk_widget_destroy on an
>>>     unpacked toolbar widget.
>>>
>>> diff --git a/src/gtkutil.c b/src/gtkutil.c
>>> index 0e9dd4dfe11..97582a524da 100644
>>> --- a/src/gtkutil.c
>>> +++ b/src/gtkutil.c
>>> @@ -1885,6 +1885,12 @@ xg_free_frame_widgets (struct frame *f)
>>>        if (tbinfo)
>>>          xfree (tbinfo);
>>>
>>> +      if (x->toolbar_widget && !x->toolbar_is_packed)
>>> +	{
>>> +	  gtk_widget_destroy (x->toolbar_widget);
>>> +	  x->toolbar_widget = NULL;
>>> +	}
>>> +
>>>        /* x_free_frame_resources should have taken care of it */
>>>  #ifndef HAVE_PGTK
>>>  #ifdef HAVE_XDBE
>>
>> LGTM.
>
> Thanks, pushed.

While GTK remains very slow due to MPS limitations and the way we work
around them, I'll file a new bug when we have a way around that, and
closing this one.  Thanks!

Pip