mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
info: only open log file when adding it to the log function
This avoids the leak of opening it and then not passing it or closing it before it goes out of scope.
This commit is contained in:
parent
c32ea3cb58
commit
1bb699446a
1 changed files with 16 additions and 15 deletions
|
@ -299,6 +299,7 @@ _priv_gst_debug_init (void)
|
|||
const gchar *env;
|
||||
FILE *log_file;
|
||||
|
||||
if (add_default_log_func) {
|
||||
env = g_getenv ("GST_DEBUG_FILE");
|
||||
if (env != NULL && *env != '\0') {
|
||||
if (strcmp (env, "-") == 0) {
|
||||
|
@ -315,6 +316,9 @@ _priv_gst_debug_init (void)
|
|||
log_file = stderr;
|
||||
}
|
||||
|
||||
gst_debug_add_log_function (gst_debug_log_default, log_file, NULL);
|
||||
}
|
||||
|
||||
__gst_printf_pointer_extension_set_func
|
||||
(gst_info_printf_pointer_extension_func);
|
||||
|
||||
|
@ -324,9 +328,6 @@ _priv_gst_debug_init (void)
|
|||
_GST_CAT_DEBUG = _gst_debug_category_new ("GST_DEBUG",
|
||||
GST_DEBUG_BOLD | GST_DEBUG_FG_YELLOW, "debugging subsystem");
|
||||
|
||||
if (add_default_log_func)
|
||||
gst_debug_add_log_function (gst_debug_log_default, log_file, NULL);
|
||||
|
||||
/* FIXME: add descriptions here */
|
||||
GST_CAT_GST_INIT = _gst_debug_category_new ("GST_INIT",
|
||||
GST_DEBUG_BOLD | GST_DEBUG_FG_RED, NULL);
|
||||
|
|
Loading…
Reference in a new issue