Don't call g_thread_init on glib >=2.31.0

g_thread_init() is deprecated in glib 2.31.0 and later. This will call
g_thread_ini() only when compiling against older versions of glib.

BUG=1971,chromium:253566
R=pthatcher@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/40019004

Cr-Commit-Position: refs/heads/master@{#8400}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8400 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
decurtis@webrtc.org 2015-02-17 21:22:48 +00:00
parent e9facf8bb3
commit bfa3c7253f
3 changed files with 13 additions and 2 deletions

View File

@ -72,7 +72,11 @@ class CustomSocketServer : public rtc::PhysicalSocketServer {
int main(int argc, char* argv[]) {
gtk_init(&argc, &argv);
g_type_init();
g_thread_init(NULL);
// g_thread_init API is deprecated since glib 2.31.0, see release note:
// http://mail.gnome.org/archives/gnome-announce-list/2011-October/msg00041.html
#if !GLIB_CHECK_VERSION(2, 31, 0)
g_thread_init(NULL);
#endif
rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
if (FLAG_help) {
@ -116,4 +120,3 @@ int main(int argc, char* argv[]) {
rtc::CleanupSSL();
return 0;
}

View File

@ -55,7 +55,11 @@ GtkVideoRenderer::GtkVideoRenderer(int x, int y)
initial_x_(x),
initial_y_(y) {
g_type_init();
// g_thread_init API is deprecated since glib 2.31.0, see release note:
// http://mail.gnome.org/archives/gnome-announce-list/2011-October/msg00041.html
#if !GLIB_CHECK_VERSION(2, 31, 0)
g_thread_init(NULL);
#endif
gdk_threads_init();
}

View File

@ -344,7 +344,11 @@ bool DBusMonitor::AddFilter(DBusSigFilter *filter) {
bool DBusMonitor::StartMonitoring() {
if (!monitoring_thread_) {
g_type_init();
// g_thread_init API is deprecated since glib 2.31.0, see release note:
// http://mail.gnome.org/archives/gnome-announce-list/2011-October/msg00041.html
#if !GLIB_CHECK_VERSION(2, 31, 0)
g_thread_init(NULL);
#endif
GetSymbols()->dbus_g_thread_init()();
GMainContext *context = g_main_context_new();