gdkdisplay: Don’t call _get_instance_private(NULL)
While it’s documented as being safe, it triggers warnings from ubsan. While we work out the best way to deal with that inside the implementation of `G_ADD_PRIVATE` in GLib, let’s pragmatically just short-circuit the code which triggers the warning here. This is helpful because `gdk_display_get_debug_flags()` is called from a number of locations within GTK, so is likely to be hit if anyone is running a UI app under ubsan. See https://gitlab.gnome.org/GNOME/glib/-/issues/3267#note_2033550 Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/3267
This commit is contained in:
@@ -2037,9 +2037,12 @@ gdk_display_get_dmabuf_formats (GdkDisplay *display)
|
|||||||
GdkDebugFlags
|
GdkDebugFlags
|
||||||
gdk_display_get_debug_flags (GdkDisplay *display)
|
gdk_display_get_debug_flags (GdkDisplay *display)
|
||||||
{
|
{
|
||||||
|
if (display == NULL)
|
||||||
|
return _gdk_debug_flags;
|
||||||
|
|
||||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
||||||
|
|
||||||
return display ? priv->debug_flags : _gdk_debug_flags;
|
return priv->debug_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user