diff --git a/ChangeLog b/ChangeLog index f69d40f2b..02561c208 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-11-21 Emmanuele Bassi + + * clutter/clutter-main.c: Add a --g-fatal-warnings switch + for abort()-ing on warnings and criticals. + 2006-11-21 Emmanuele Bassi * configure.ac: Enable debug messages also when diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index 2f99cab5f..bc44961e9 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -45,6 +45,7 @@ static gboolean clutter_is_initialized = FALSE; static gboolean clutter_show_fps = FALSE; +static gboolean clutter_fatal_warnings = FALSE; static gchar *clutter_display_name = NULL; static int clutter_screen = 0; @@ -561,6 +562,8 @@ static GOptionEntry clutter_args[] = { "X screen to use", "SCREEN" }, { "clutter-show-fps", 0, 0, G_OPTION_ARG_NONE, &clutter_show_fps, "Show frames per second", NULL }, + { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &clutter_fatal_warnings, + "Make all warnings fatal", NULL }, #ifdef CLUTTER_ENABLE_DEBUG { "clutter-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_debug_cb, "Clutter debugging flags to set", "FLAGS" }, @@ -624,6 +627,18 @@ post_parse_hook (GOptionContext *context, { ClutterMainContext *clutter_context; + if (clutter_is_initialized) + return TRUE; + + if (clutter_fatal_warnings) + { + GLogLevelFlags fatal_mask; + + fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); + fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL; + g_log_set_always_fatal (fatal_mask); + } + clutter_context = clutter_context_get_default (); clutter_context->main_loops = NULL; clutter_context->main_loop_level = 0;