From: Sebastian Dröge Date: Mon, 22 Oct 2012 08:25:40 +0000 (+0200) Subject: info: Don't use GST_DEBUG() in gst_debug_add_log_function() and related functions... X-Git-Tag: 1.0.2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=32d7d5923b35a76cb2e8b6805372b74dc5f73f01;p=platform%2Fupstream%2Fgstreamer.git info: Don't use GST_DEBUG() in gst_debug_add_log_function() and related functions unconditionally If GStreamer was not initialized yet this will cause g_warnings(). --- diff --git a/gst/gstinfo.c b/gst/gstinfo.c index eadb5e0..5929d10 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -129,6 +129,8 @@ #endif /* !GST_DISABLE_GST_DEBUG */ +extern gboolean gst_is_initialized (void); + /* we want these symbols exported even if debug is disabled, to maintain * ABI compatibility. Unless GST_REMOVE_DISABLED is defined. */ #if !defined(GST_DISABLE_GST_DEBUG) || !defined(GST_REMOVE_DISABLED) @@ -1104,8 +1106,9 @@ gst_debug_add_log_function (GstLogFunction func, gpointer user_data, __log_functions = g_slist_prepend (list, entry); g_mutex_unlock (&__log_func_mutex); - GST_DEBUG ("prepended log function %p (user data %p) to log functions", - func, user_data); + if (gst_is_initialized ()) + GST_DEBUG ("prepended log function %p (user data %p) to log functions", + func, user_data); } static gint @@ -1180,8 +1183,9 @@ gst_debug_remove_log_function (GstLogFunction func) removals = gst_debug_remove_with_compare_func (gst_debug_compare_log_function_by_func, (gpointer) func); - GST_DEBUG ("removed log function %p %d times from log function list", func, - removals); + if (gst_is_initialized ()) + GST_DEBUG ("removed log function %p %d times from log function list", func, + removals); return removals; } @@ -1202,9 +1206,11 @@ gst_debug_remove_log_function_by_data (gpointer data) removals = gst_debug_remove_with_compare_func (gst_debug_compare_log_function_by_data, data); - GST_DEBUG - ("removed %d log functions with user data %p from log function list", - removals, data); + + if (gst_is_initialized ()) + GST_DEBUG + ("removed %d log functions with user data %p from log function list", + removals, data); return removals; } @@ -1311,8 +1317,9 @@ gst_debug_reset_threshold (gpointer category, gpointer unused) walk = g_slist_next (walk); if (g_pattern_match_string (entry->pat, cat->name)) { - GST_LOG ("category %s matches pattern %p - gets set to level %d", - cat->name, entry->pat, entry->level); + if (gst_is_initialized ()) + GST_LOG ("category %s matches pattern %p - gets set to level %d", + cat->name, entry->pat, entry->level); gst_debug_category_set_threshold (cat, entry->level); goto exit; } @@ -1338,8 +1345,9 @@ for_each_threshold_by_entry (gpointer data, gpointer user_data) LevelNameEntry *entry = (LevelNameEntry *) user_data; if (g_pattern_match_string (entry->pat, cat->name)) { - GST_LOG ("category %s matches pattern %p - gets set to level %d", - cat->name, entry->pat, entry->level); + if (gst_is_initialized ()) + GST_LOG ("category %s matches pattern %p - gets set to level %d", + cat->name, entry->pat, entry->level); gst_debug_category_set_threshold (cat, entry->level); } }