After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 751538 - info: gst_debug_log_default() function can't be removed before gst_init()
info: gst_debug_log_default() function can't be removed before gst_init()
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal normal
: 1.9.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-06-26 11:53 UTC by Heinrich Fink
Modified: 2016-03-26 11:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to only add the default logger in gst_init if no loggers have been added yet. (1.79 KB, patch)
2015-06-26 11:53 UTC, Heinrich Fink
rejected Details | Review
[alternative patch] info: make it possible to remove default log handler before gst_init() (1.99 KB, patch)
2016-02-29 19:08 UTC, Tim-Philipp Müller
committed Details | Review

Description Heinrich Fink 2015-06-26 11:53:01 UTC
Created attachment 306162 [details] [review]
Patch to only add the default logger in gst_init if no loggers have been added yet.

When trying to only use external logging functions, the user might try to add its own log handler and remove the default logging function before gst_init (e.g. see http://cgit.freedesktop.org/gstreamer/cerbero/tree/data/ndk-build/gstreamer_android-1.0.c.in#n482). However, because gst_init (i.e. _priv_gst_debug_init, gstinfo.c) unconditionally adds the gst_debug_log_default function to the list of active loggers, the default log handlers is still being added and additionally used later on.

This could be partially worked around by removing gst_debug_log_default after gst_init (notice, though that removal of log functions might be racy, see 751440), but that would still cause logging during gst_init to be logged to the default logger.

I have attached a patch for a simple solution for this use case: Only add the default log function during gst_init if no log function has been added by the user yet.
Comment 1 Tim-Philipp Müller 2016-02-29 19:08:52 UTC
Created attachment 322693 [details] [review]
[alternative patch] info: make it possible to remove default log handler before gst_init()

I'd rather do something like this, which doesn't break current behaviour.
Comment 2 Heinrich Fink 2016-03-09 13:31:56 UTC
looks good :)
Comment 3 Tim-Philipp Müller 2016-03-26 11:48:14 UTC
Great!

commit 50888062ba6bd32e503de2393b7496ba1fcdb26c
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Mon Feb 29 19:04:16 2016 +0000

    info: make it possible to remove default log handler before gst_init()
    
    Make sure it's not even added then, so that we never output
    anything via the default log handler then.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751538