Bug 1676022 - Silence some glib deprecation warnings, r=stransky

Differential Revision: https://phabricator.services.mozilla.com/D96323
This commit is contained in:
Robert Mader 2020-11-09 11:53:41 +00:00
parent ed1f2eae50
commit ce8b2c945f
7 changed files with 4 additions and 46 deletions

View File

@ -49,10 +49,6 @@ DownloadPlatform* DownloadPlatform::GetDownloadPlatform() {
NS_ADDREF(gDownloadPlatformService);
#if defined(MOZ_WIDGET_GTK)
g_type_init();
#endif
return gDownloadPlatformService;
}

View File

@ -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}',

View File

@ -9,7 +9,6 @@ with Files("**"):
SOURCES += [
"nsAlertsIconListener.cpp",
"nsGnomeModule.cpp",
"nsSystemAlertsService.cpp",
]

View File

@ -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 <glib-object.h>
namespace mozilla {
nsresult InitGType() {
g_type_init();
return NS_OK;
}
} // namespace mozilla

View File

@ -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

View File

@ -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

View File

@ -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),