Fix g_static_private_get/set glib deprecated clang warnings in widget/gtk2/.

NEW
Unassigned

Status

()

6 years ago
5 years ago

People

(Reporter: karlt, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
+++ This bug was initially created as a clone of Bug #826158 +++

Clang 3.2 gives these warnings in widget/gtk2/:

  widget/gtk2/nsSound.cpp:96:37 [-Wdeprecated-declarations] 'g_static_private_get' is deprecated
  widget/gtk2/nsSound.cpp:107:5 [-Wdeprecated-declarations] 'g_static_private_set' is deprecated

g_static_private_get is marked GLIB_DEPRECATED_IN_2_32_FOR(g_private_get).
I don't get the warning with gcc, even though I have 2.32 here.  I wonder why.

http://developer.gnome.org/glib/2.30/glib-Threads.html#GPrivate says
"GStaticPrivate is a better choice for most uses."

http://git.gnome.org/browse/glib/commit/glib/deprecated/gthread.h?id=3d4846d92309d001697c2827660fa41b5c63dbc4
says "GStaticPrivate has been made redundant by adding comparable capabilities to GPrivate."

http://developer.gnome.org/glib/2.32/glib-Threads.html#GPrivate says
"GPrivate is a very limited resource (as far as 128 per program, shared between all libraries). It is also not possible to destroy a GPrivate after it has been used. As such, it is only ever acceptable to use GPrivate in static scope, and even then sparingly so."

Perhaps GPrivate can be used instead of GStaticPrivate now, but
G_PRIVATE_INIT() is only available with older GLib 2.32 and newer, and we
build against older GLib.  And I assume GPrivate does not do the right thing
with older GLib.

Sounds like we should not be using GPrivate if at all possible.
(Reporter)

Comment 1

6 years ago
I guess this is a global context on the main thread and the issue is a context
possibly still playing during shutdown.
I wonder whether there is a way to wait (on shutdown) for the sound to finish
playing.
Or probably simpler and better, call ca_context_cancel to stop playing the
sounds.  Looks like all sounds have the same id so they are easy to cancel.
I wonder whether _cancel waits for the playing thread.

http://0pointer.de/lennart/projects/libcanberra/gtkdoc/libcanberra-canberra.html#ca-context-play
http://0pointer.de/lennart/projects/libcanberra/gtkdoc/libcanberra-canberra.html#ca-context-cancel
(Reporter)

Updated

5 years ago
Summary: Fix three clang warnings in widget/gtk2/. → Fix g_static_private_get/set glib deprecated clang warnings in widget/gtk2/.
You need to log in before you can comment on or make changes to this bug.