mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 19:55:32 +00:00
init: don't spew warning about late g_thread_init()s if GLib >= 2.23.2
Late g_thread_init() is fine with newer GLib versions and done automatically from g_type_init() there, so don't warn if the application hasn't called g_thread_init() yet when gst_init() is called with new GLib versions. Fixes #608398.
This commit is contained in:
parent
79d3f1a2c1
commit
6c6f20e0b6
1 changed files with 26 additions and 15 deletions
41
gst/gst.c
41
gst/gst.c
|
@ -359,24 +359,30 @@ gst_init_get_option_group (void)
|
|||
{NULL}
|
||||
};
|
||||
|
||||
/* The GLib threading system must be initialised before calling any other
|
||||
* GLib function according to the documentation; if the application hasn't
|
||||
* called gst_init() yet or initialised the threading system otherwise, we
|
||||
* better issue a warning here (since chances are high that the application
|
||||
* has already called other GLib functions such as g_option_context_new() */
|
||||
/* Since GLib 2.23.2 calling g_thread_init() 'late' is allowed and is
|
||||
* automatically done as part of g_type_init() */
|
||||
if (!glib_check_version (2, 23, 3)) {
|
||||
/* The GLib threading system must be initialised before calling any other
|
||||
* GLib function according to the documentation; if the application hasn't
|
||||
* called gst_init() yet or initialised the threading system otherwise, we
|
||||
* better issue a warning here (since chances are high that the application
|
||||
* has already called other GLib functions such as g_option_context_new() */
|
||||
#if GLIB_CHECK_VERSION (2,20,0)
|
||||
if (!g_thread_get_initialized ()) {
|
||||
if (!g_thread_get_initialized ()) {
|
||||
#else
|
||||
if (!g_thread_supported ()) {
|
||||
if (!g_thread_supported ()) {
|
||||
#endif
|
||||
g_warning ("The GStreamer function gst_init_get_option_group() was\n"
|
||||
"\tcalled, but the GLib threading system has not been initialised\n"
|
||||
"\tyet, something that must happen before any other GLib function\n"
|
||||
"\tis called. The application needs to be fixed so that it calls\n"
|
||||
"\t if (!g_thread_supported ()) g_thread_init(NULL);\n"
|
||||
"\tas very first thing in its main() function. Please file a bug\n"
|
||||
"\tagainst this application.");
|
||||
g_thread_init (NULL);
|
||||
g_warning ("The GStreamer function gst_init_get_option_group() was\n"
|
||||
"\tcalled, but the GLib threading system has not been initialised\n"
|
||||
"\tyet, something that must happen before any other GLib function\n"
|
||||
"\tis called. The application needs to be fixed so that it calls\n"
|
||||
"\t if (!g_thread_get_initialized ()) g_thread_init(NULL);\n"
|
||||
"\tas very first thing in its main() function. Please file a bug\n"
|
||||
"\tagainst this application.");
|
||||
g_thread_init (NULL);
|
||||
}
|
||||
} else {
|
||||
/* GLib >= 2.23.2 */
|
||||
}
|
||||
|
||||
group = g_option_group_new ("gst", _("GStreamer Options"),
|
||||
|
@ -785,6 +791,11 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
|
|||
}
|
||||
#endif /* GST_DISABLE_TRACE */
|
||||
|
||||
GST_INFO ("GLib runtime version: %d.%d.%d\n", glib_major_version,
|
||||
glib_minor_version, glib_micro_version);
|
||||
GST_INFO ("GLib headers version: %d.%d.%d\n", GLIB_MAJOR_VERSION,
|
||||
GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue