gtk: Fixed memory leak in Gtk.TextHandle

gdk_surface_set_input_region does not take ownership of the region
passed into it, so we'll need to free it afterward.
This commit is contained in:
Florian "sp1rit"​
2024-10-09 16:16:35 +02:00
parent 53cbc64f41
commit 347f5fdda4

View File

@@ -246,13 +246,17 @@ gtk_text_handle_realize (GtkWidget *widget)
GtkTextHandle *handle = GTK_TEXT_HANDLE (widget);
GdkSurface *parent_surface;
GtkWidget *parent;
cairo_region_t *region;
parent = gtk_widget_get_parent (widget);
parent_surface = gtk_native_get_surface (gtk_widget_get_native (parent));
handle->surface = gdk_surface_new_popup (parent_surface, FALSE);
gdk_surface_set_widget (handle->surface, widget);
gdk_surface_set_input_region (handle->surface, cairo_region_create ());
region = cairo_region_create ();
gdk_surface_set_input_region (handle->surface, region);
cairo_region_destroy (region);
g_signal_connect_swapped (handle->surface, "notify::mapped",
G_CALLBACK (surface_mapped_changed), widget);