[gtk/gtk-3-24: 1/2] Print a warning if GTK_DEBUG is set but gtk isn't built with G_ENABLE_DEBUG



commit e65c703741999ac6c6465e973b1505ae0a5c2a7d
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sat Sep 28 20:54:38 2019 +0200

    Print a warning if GTK_DEBUG is set but gtk isn't built with G_ENABLE_DEBUG
    
    G_ENABLE_DEBUG is tied to the meson builttype property, so building with "plain"
    results in G_ENABLE_DEBUG not being defined and the GTK_DEBUG env var just gets ignored
    for that build.
    
    Since it can be confusing that GTK_DEBUG has no effect print a warning message instead.
    
    Fixes #2020

 gtk/gtkmain.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 12b5d6659d..ca56f94a38 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -657,16 +657,18 @@ do_pre_parse_initialization (int    *argc,
   GDK_PRIVATE_CALL (gdk_pre_parse) ();
   gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, NULL, NULL);
 
-#ifdef G_ENABLE_DEBUG
   env_string = g_getenv ("GTK_DEBUG");
   if (env_string != NULL)
     {
+#ifdef G_ENABLE_DEBUG
       debug_flags[0].flags = g_parse_debug_string (env_string,
                                                    gtk_debug_keys,
                                                    G_N_ELEMENTS (gtk_debug_keys));
+#else
+      g_warning ("GTK_DEBUG set but ignored because gtk isn't built with G_ENABLE_DEBUG");
+#endif  /* G_ENABLE_DEBUG */
       env_string = NULL;
     }
-#endif  /* G_ENABLE_DEBUG */
 
   env_string = g_getenv ("GTK3_MODULES");
   if (env_string)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]