Open Bug 843288 Opened 11 years ago Updated 2 years ago

Fix g_static_private_get/set glib deprecated clang warnings in widget/gtk/nsSound.cpp

Categories

(Core :: Widget: Gtk, defect)

defect

Tracking

()

REOPENED

People

(Reporter: karlt, Unassigned)

References

(Blocks 1 open bug)

Details

+++ 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.
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
Summary: Fix three clang warnings in widget/gtk2/. → Fix g_static_private_get/set glib deprecated clang warnings in widget/gtk2/.
Closing GTK2 related bugs since we removed GTK2 support at the beginning of 2018 in bug 1278282. Probably best to open a new bug in the unlikely event that any of these are still relevant.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Summary: Fix g_static_private_get/set glib deprecated clang warnings in widget/gtk2/. → Fix g_static_private_get/set glib deprecated clang warnings in widget/gtk/nsSound.cpp
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.