From 6ccca51feeb0204f18c9a93ce9ef9fb9405ce402 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Fri, 11 Jul 2014 16:54:06 +0200 Subject: [PATCH] Compiler warning fixes. g_thread_init is automatically called since 2.32 (and deprecated since 2.35). g_type_init is automatically called since 2.36 and will be deprecated in the future. --- indra/llwindow/llwindowsdl.cpp | 2 ++ indra/newview/llappviewerlinux.cpp | 6 ++++++ indra/plugins/filepicker/legacy.cpp | 2 ++ indra/plugins/gstreamer010/media_plugin_gstreamer010.cpp | 7 +++++-- indra/plugins/webkit/linux_volume_catcher.cpp | 4 ++++ indra/plugins/webkit/media_plugin_webkit.cpp | 4 ++++ 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 341739d1d..e7832731e 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -125,7 +125,9 @@ bool LLWindowSDL::ll_try_gtk_init(void) if (!tried_gtk_init) { tried_gtk_init = TRUE; +#if !GLIB_CHECK_VERSION(2, 32, 0) if (!g_thread_supported ()) g_thread_init (NULL); +#endif maybe_lock_display(); gtk_is_good = gtk_init_check(NULL, NULL); maybe_unlock_display(); diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index c923462fd..a8e2454f4 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -133,11 +133,13 @@ LLAppViewerLinux::~LLAppViewerLinux() bool LLAppViewerLinux::init() { +#if !GLIB_CHECK_VERSION(2, 32, 0) // g_thread_init() must be called before *any* use of glib, *and* // before any mutexes are held, *and* some of our third-party // libraries likes to use glib functions; in short, do this here // really early in app startup! if (!g_thread_supported ()) g_thread_init (NULL); +#endif bool success = LLAppViewer::init(); @@ -277,7 +279,9 @@ bool LLAppViewerLinux::initSLURLHandler() return false; // failed } +#if !GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); +#endif //ViewerAppAPI *api_server = (ViewerAppAPI*) g_object_new(viewerappapi_get_type(), NULL); @@ -297,7 +301,9 @@ bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url) DBusGConnection *bus; GError *error = NULL; +#if !GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); +#endif bus = lldbus_g_bus_get (DBUS_BUS_SESSION, &error); if (bus) diff --git a/indra/plugins/filepicker/legacy.cpp b/indra/plugins/filepicker/legacy.cpp index e106923bf..6ced24fb3 100644 --- a/indra/plugins/filepicker/legacy.cpp +++ b/indra/plugins/filepicker/legacy.cpp @@ -70,7 +70,9 @@ namespace LLWindowSDL { if (!tried_gtk_init) { tried_gtk_init = TRUE; +#if !GLIB_CHECK_VERSION(2, 32, 0) if (!g_thread_supported ()) g_thread_init (NULL); +#endif //maybe_lock_display(); gtk_is_good = gtk_init_check(NULL, NULL); //maybe_unlock_display(); diff --git a/indra/plugins/gstreamer010/media_plugin_gstreamer010.cpp b/indra/plugins/gstreamer010/media_plugin_gstreamer010.cpp index 38a6805fe..18739f093 100644 --- a/indra/plugins/gstreamer010/media_plugin_gstreamer010.cpp +++ b/indra/plugins/gstreamer010/media_plugin_gstreamer010.cpp @@ -793,10 +793,13 @@ MediaPluginGStreamer010::startup() // only do global GStreamer initialization once. if (!mDoneInit) { - g_thread_init(NULL); - +#if !GLIB_CHECK_VERSION(2, 36, 0) +#if !GLIB_CHECK_VERSION(2, 32, 0) + if (!g_thread_supported()) g_thread_init(NULL); +#endif // Init the glib type system - we need it. g_type_init(); +#endif set_gst_plugin_path(); diff --git a/indra/plugins/webkit/linux_volume_catcher.cpp b/indra/plugins/webkit/linux_volume_catcher.cpp index 5298056fd..446527975 100644 --- a/indra/plugins/webkit/linux_volume_catcher.cpp +++ b/indra/plugins/webkit/linux_volume_catcher.cpp @@ -227,9 +227,13 @@ void VolumeCatcherImpl::init() mGotSyms = loadsyms("libpulse-mainloop-glib.so.0"); if (!mGotSyms) return; +#if !GLIB_CHECK_VERSION(2, 36, 0) +#if !GLIB_CHECK_VERSION(2, 32, 0) // better make double-sure glib itself is initialized properly. if (!g_thread_supported ()) g_thread_init (NULL); +#endif g_type_init(); +#endif mMainloop = llpa_glib_mainloop_new(g_main_context_default()); if (mMainloop) diff --git a/indra/plugins/webkit/media_plugin_webkit.cpp b/indra/plugins/webkit/media_plugin_webkit.cpp index b1d0b00b0..9fd5fccd1 100644 --- a/indra/plugins/webkit/media_plugin_webkit.cpp +++ b/indra/plugins/webkit/media_plugin_webkit.cpp @@ -229,12 +229,16 @@ private: std::string application_dir = std::string( cwd ); #if LL_LINUX +#if !GLIB_CHECK_VERSION(2, 36, 0) +#if !GLIB_CHECK_VERSION(2, 32, 0) // take care to initialize glib properly, because some // versions of Qt don't, and we indirectly need it for (some // versions of) Flash to not crash the browser. if (!g_thread_supported ()) g_thread_init (NULL); +#endif g_type_init(); #endif +#endif #if LL_DARWIN // When running under the Xcode debugger, there's a setting called "Break on Debugger()/DebugStr()" which defaults to being turned on.