From a40357a1658f8de040fbee10049e72647e2e7363 Mon Sep 17 00:00:00 2001 From: Jehan Date: Tue, 29 Aug 2023 15:27:02 +0200 Subject: [PATCH] libgimp: take into account case when gtk_settings_get_default() returns NULL. I believe it should not happen in normal GUI case (which is when you create a GimpProcedureDialog). I had the issue while moving around some plug-in code and moved dialog creation before gimp_ui_init() by mistake. The issue was not obvious until I followed the trace inside libgimp. This would be even more frustrating for plug-in developers so let's have a clear warning message giving the possible plug-in crash reason. --- libgimp/gimpproceduredialog.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libgimp/gimpproceduredialog.c b/libgimp/gimpproceduredialog.c index 2512628d16..c8626954e8 100644 --- a/libgimp/gimpproceduredialog.c +++ b/libgimp/gimpproceduredialog.c @@ -206,9 +206,13 @@ gimp_procedure_dialog_constructor (GType type, gboolean use_header_bar_edited = FALSE; gboolean help_func_edited = FALSE; - g_object_get (gtk_settings_get_default (), - "gtk-dialogs-use-header", &use_header_bar, - NULL); + if (gtk_settings_get_default () != NULL) + g_object_get (gtk_settings_get_default (), + "gtk-dialogs-use-header", &use_header_bar, + NULL); + else + g_warning ("%s: no default screen. Did you call gimp_ui_init()?", G_STRFUNC); + for (guint i = 0; i < n_construct_properties; i++) {