mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 23:24:16 +00:00
gtk: fix NULL pointer dereference
`gtk_window_get_default_size()` claims width/height are optional-out arguments, but defers to `gtk_window_get_remembered_size()` which may dereference a NULL-pointer. Since `gtk_window_get_remembered_size()` is only called by `gtk_window_get_default_size()`, collapse it into the latter and perform the NULL check there.
This commit is contained in:
parent
ce4d8cc6d9
commit
f8c9b3394b
@ -397,10 +397,6 @@ static int gtk_window_focus (GtkWidget *widget,
|
||||
static void gtk_window_move_focus (GtkWidget *widget,
|
||||
GtkDirectionType dir);
|
||||
|
||||
static void gtk_window_get_remembered_size (GtkWindow *window,
|
||||
int *width,
|
||||
int *height);
|
||||
|
||||
static void gtk_window_real_activate_default (GtkWindow *window);
|
||||
static void gtk_window_real_activate_focus (GtkWindow *window);
|
||||
static void gtk_window_keys_changed (GtkWindow *window);
|
||||
@ -3659,9 +3655,15 @@ gtk_window_get_default_size (GtkWindow *window,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
|
||||
gtk_window_get_remembered_size (window, width, height);
|
||||
if (width != NULL)
|
||||
*width = priv->default_width;
|
||||
|
||||
if (height != NULL)
|
||||
*height = priv->default_height;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -3984,17 +3986,6 @@ gtk_window_unmap (GtkWidget *widget)
|
||||
gtk_widget_unmap (child);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_window_get_remembered_size (GtkWindow *window,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
|
||||
*width = priv->default_width;
|
||||
*height = priv->default_height;
|
||||
}
|
||||
|
||||
static void
|
||||
check_scale_changed (GtkWindow *window)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user