mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 09:40:10 +00:00
gtk: Fix more ubsan warnings
Most of these are calling a get_instance_private() function before checking that the object isn't NULL.
This commit is contained in:
parent
815df9a76a
commit
246eb8ea25
@ -990,11 +990,13 @@ GtkActionMuxer *
|
||||
gtk_application_get_parent_muxer_for_window (GtkWindow *window)
|
||||
{
|
||||
GtkApplication *application = gtk_window_get_application (window);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
GtkApplicationPrivate *priv;
|
||||
|
||||
if (!application)
|
||||
return NULL;
|
||||
|
||||
priv = gtk_application_get_instance_private (application);
|
||||
|
||||
return priv->muxer;
|
||||
}
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ gtk_check_button_set_group (GtkCheckButton *self,
|
||||
GtkCheckButton *group)
|
||||
{
|
||||
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (self);
|
||||
GtkCheckButtonPrivate *group_priv = gtk_check_button_get_instance_private (group);
|
||||
GtkCheckButtonPrivate *group_priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CHECK_BUTTON (self));
|
||||
g_return_if_fail (self != group);
|
||||
@ -1037,6 +1037,8 @@ gtk_check_button_set_group (GtkCheckButton *self,
|
||||
if (priv->group_next == group)
|
||||
return;
|
||||
|
||||
group_priv = gtk_check_button_get_instance_private (group);
|
||||
|
||||
priv->group_prev = NULL;
|
||||
if (group_priv->group_prev)
|
||||
{
|
||||
|
@ -637,7 +637,7 @@ resource_is_pixdata (const char *resource_path)
|
||||
if (data_size < sizeof(guint32))
|
||||
goto out;
|
||||
|
||||
magic = (stream[0] << 24) + (stream[1] << 16) + (stream[2] << 8) + stream[3];
|
||||
magic = (((guint32)(stream[0])) << 24) | (((guint32)(stream[1])) << 16) | (((guint32)(stream[2])) << 8) | (guint32)(stream[3]);
|
||||
if (magic == GDK_PIXBUF_MAGIC_NUMBER)
|
||||
ret = TRUE;
|
||||
|
||||
|
@ -511,7 +511,7 @@ gtk_toggle_button_set_group (GtkToggleButton *toggle_button,
|
||||
GtkToggleButton *group)
|
||||
{
|
||||
GtkToggleButtonPrivate *priv = gtk_toggle_button_get_instance_private (toggle_button);
|
||||
GtkToggleButtonPrivate *group_priv = gtk_toggle_button_get_instance_private (group);
|
||||
GtkToggleButtonPrivate *group_priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
|
||||
g_return_if_fail (toggle_button != group);
|
||||
@ -538,6 +538,8 @@ gtk_toggle_button_set_group (GtkToggleButton *toggle_button,
|
||||
if (priv->group_next == group)
|
||||
return;
|
||||
|
||||
group_priv = gtk_toggle_button_get_instance_private (group);
|
||||
|
||||
priv->group_prev = NULL;
|
||||
if (group_priv->group_prev)
|
||||
{
|
||||
|
@ -5834,21 +5834,22 @@ gtk_window_is_active (GtkWindow *window)
|
||||
*/
|
||||
GtkWindowGroup *
|
||||
gtk_window_get_group (GtkWindow *window)
|
||||
{
|
||||
static GtkWindowGroup *default_group = NULL;
|
||||
|
||||
if (window)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
|
||||
if (window && priv->group)
|
||||
if (priv->group)
|
||||
return priv->group;
|
||||
else
|
||||
{
|
||||
static GtkWindowGroup *default_group = NULL;
|
||||
}
|
||||
|
||||
if (!default_group)
|
||||
default_group = gtk_window_group_new ();
|
||||
|
||||
return default_group;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_window_has_group:
|
||||
|
Loading…
Reference in New Issue
Block a user