From d2045f49bbb40b86a408b3ec3a335fc4c56ab4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20M=C3=ADchal?= Date: Tue, 11 Nov 2025 11:55:52 +0200 Subject: [PATCH] plug-ins/filter-browser: Correctly start/stop GMainLoop I incorrectly read the GMainLoop documentation and thought that calling g_main_loop_new with NULL as the first parameter will return the "default GMainLoop". This is wrong and it resulted in the original GMainLoop to never stop and therefore for the plug-in to never stop. This also adds a call to unref for the GMainLoop. --- plug-ins/filter-browser/filter-browser.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plug-ins/filter-browser/filter-browser.c b/plug-ins/filter-browser/filter-browser.c index dab5d2a5aa..7217fe007f 100644 --- a/plug-ins/filter-browser/filter-browser.c +++ b/plug-ins/filter-browser/filter-browser.c @@ -86,6 +86,8 @@ G_DEFINE_TYPE (FilterBrowser, filter_browser, GIMP_TYPE_PLUG_IN) GIMP_MAIN (FILTER_BROWSER_TYPE) DEFINE_STD_SET_I18N +static GMainLoop *main_loop = NULL; + static GtkWidget * create_filter_param_details (GParamSpec *pspec, GtkSizeGroup *sg_label, @@ -699,7 +701,8 @@ browser_dialog_response (GtkWidget *widget, gtk_widget_destroy (browser->dialog); g_list_free (browser->filters); g_free (browser); - g_main_loop_quit (g_main_loop_new (NULL, TRUE)); + g_main_loop_quit (main_loop); + g_main_loop_unref (main_loop); } static GimpValueArray * @@ -807,7 +810,9 @@ filter_browser_run (GimpProcedure *procedure, gtk_list_box_get_row_at_index (browser->filter_list, 0)); gtk_widget_show (GTK_WIDGET (browser->dialog)); - g_main_loop_run (g_main_loop_new (NULL, TRUE)); + + main_loop = g_main_loop_new (NULL, TRUE); + g_main_loop_run (main_loop); return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL); }