From 7479133753de0f7827bf74cf8b554f266af69d20 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 2 Dec 2013 11:03:28 +0000 Subject: [PATCH] gtkentry: Call get_*_size() vfuncs unconditionally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These vfuncs cannot be NULL: implementations are provided by GtkEntry, and subclasses should not set them to NULL. Instead of conditionalising the calls to the vfuncs, assert that they’re set and call them unconditionally. This prevents the possibility of a subclass setting the vfunc to NULL and then a gtk_entry_get_*_size() call returning undefined values in its out variables. https://bugzilla.gnome.org/show_bug.cgi?id=712760 --- gtk/gtkentry.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 3a2f203031..dfe08d3833 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3626,8 +3626,8 @@ get_text_area_size (GtkEntry *entry, class = GTK_ENTRY_GET_CLASS (entry); - if (class->get_text_area_size) - class->get_text_area_size (entry, x, y, width, height); + g_assert (class->get_text_area_size != NULL); + class->get_text_area_size (entry, x, y, width, height); } @@ -3704,8 +3704,8 @@ get_frame_size (GtkEntry *entry, class = GTK_ENTRY_GET_CLASS (entry); - if (class->get_frame_size) - class->get_frame_size (entry, x, y, width, height); + g_assert (class->get_frame_size != NULL); + class->get_frame_size (entry, x, y, width, height); if (!relative_to_window) {