diff --git a/toolkit/components/downloads/DownloadPlatform.cpp b/toolkit/components/downloads/DownloadPlatform.cpp index 44986aad765a..a1a2fafa7c4f 100644 --- a/toolkit/components/downloads/DownloadPlatform.cpp +++ b/toolkit/components/downloads/DownloadPlatform.cpp @@ -49,10 +49,6 @@ DownloadPlatform* DownloadPlatform::GetDownloadPlatform() { NS_ADDREF(gDownloadPlatformService); -#if defined(MOZ_WIDGET_GTK) - g_type_init(); -#endif - return gDownloadPlatformService; } diff --git a/toolkit/system/gnome/components.conf b/toolkit/system/gnome/components.conf index aa20019def03..1aa0ab104873 100644 --- a/toolkit/system/gnome/components.conf +++ b/toolkit/system/gnome/components.conf @@ -4,12 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -InitFunc = 'mozilla::InitGType' - -Headers = [ - '/toolkit/system/gnome/nsGnomeModule.h', -] - Classes = [ { 'cid': '{e3a1f3c9-3ae1-4b40-a5e0-7b457fc9a9ad}', diff --git a/toolkit/system/gnome/moz.build b/toolkit/system/gnome/moz.build index 77330ca644a9..0fc94ed9e39a 100644 --- a/toolkit/system/gnome/moz.build +++ b/toolkit/system/gnome/moz.build @@ -9,7 +9,6 @@ with Files("**"): SOURCES += [ "nsAlertsIconListener.cpp", - "nsGnomeModule.cpp", "nsSystemAlertsService.cpp", ] diff --git a/toolkit/system/gnome/nsGnomeModule.cpp b/toolkit/system/gnome/nsGnomeModule.cpp deleted file mode 100644 index f073bc0d1b68..000000000000 --- a/toolkit/system/gnome/nsGnomeModule.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsGnomeModule.h" - -#include - -namespace mozilla { -nsresult InitGType() { - g_type_init(); - return NS_OK; -} -} // namespace mozilla diff --git a/toolkit/system/gnome/nsGnomeModule.h b/toolkit/system/gnome/nsGnomeModule.h deleted file mode 100644 index 2cbe69a35da2..000000000000 --- a/toolkit/system/gnome/nsGnomeModule.h +++ /dev/null @@ -1,10 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nscore.h" - -namespace mozilla { -nsresult InitGType(); -} // namespace mozilla diff --git a/widget/gtk/nsAppShell.cpp b/widget/gtk/nsAppShell.cpp index cfe022e65d82..24bdd5083375 100644 --- a/widget/gtk/nsAppShell.cpp +++ b/widget/gtk/nsAppShell.cpp @@ -116,12 +116,6 @@ nsAppShell::~nsAppShell() { } nsresult nsAppShell::Init() { - // For any versions of Glib before 2.36, g_type_init must be explicitly called - // to safely use the library. Failure to do so may cause various - // failures/crashes in any code that uses Glib, Gdk, or Gtk. In later versions - // of Glib, this call is a no-op. - g_type_init(); - mozilla::hal::Init(); #ifdef MOZ_ENABLE_DBUS diff --git a/widget/gtk/nsSound.cpp b/widget/gtk/nsSound.cpp index d71c9db28f18..4d685d856600 100644 --- a/widget/gtk/nsSound.cpp +++ b/widget/gtk/nsSound.cpp @@ -82,9 +82,10 @@ struct ScopedCanberraFile { static ca_context* ca_context_get_default() { // This allows us to avoid race conditions with freeing the context by handing // that responsibility to Glib, and still use one context at a time - static GStaticPrivate ctx_static_private = G_STATIC_PRIVATE_INIT; + static GPrivate ctx_private = + G_PRIVATE_INIT((GDestroyNotify)ca_context_destroy); - ca_context* ctx = (ca_context*)g_static_private_get(&ctx_static_private); + ca_context* ctx = (ca_context*)g_private_get(&ctx_private); if (ctx) { return ctx; @@ -95,8 +96,7 @@ static ca_context* ca_context_get_default() { return nullptr; } - g_static_private_set(&ctx_static_private, ctx, - (GDestroyNotify)ca_context_destroy); + g_private_set(&ctx_private, ctx); GtkSettings* settings = gtk_settings_get_default(); if (g_object_class_find_property(G_OBJECT_GET_CLASS(settings),