Subject: bug#75636: GTK memory leaks

From: Po Lu <[email-masked]>
Date: Sat, 18 Jan 2025 17:10:00 +0800

Pip Cet <[email-masked]> writes:

> Creating and destroying GTK frames (using gtkutil.c, not PGTK) currently
> leaks some memory, particularly when using tool bars.
>
> 1. The input "multicontext" created by:
>
>   imc = gtk_im_multicontext_new ();
>   g_object_ref (imc);
>
> is only unref'd once when destroying the frame.  This leaves the
> refcount at 1 and leaks the object.

Strange, I was under the impression that IM contexts descended from
GInitiallyUnowned.  Evidently they don't, and as such, removing the
g_object_ref will suffice.

> 2. free_frame_tool_bar is never called in my experiments, so the toolbar
> widget isn't destroyed.

It is only supposed to be called when a frame's tool bar is disabled.
while it is x_free_frame_resources that should release all resources
when a frame is to be destroyed.