GNOME Bugzilla – Bug 525206
Remove superfluous non-NULL tests for the GtkScrolledWindow scrollbars
Last modified: 2014-05-22 11:35:39 UTC
GtkScrolledWindow contains code which check that the hscrollbar and vscrollbar attributes are non-NULL. Other code just assumes that they are non-NULL. It seems to me that there is no way to make them NULL after the GtkScrolledWindow object has been created. So here is a patch that removes those checks.
Created attachment 108293 [details] [review] Remove redundant not-NULL checks from GtkScrolledWindow
Created attachment 108295 [details] [review] New patch without color codes :)
Does g_object_new (GTK_TYPE_SCROLLED_WINDOW, NULL) set the scrollbars ?
AFAICT, yes. This test code seem to prove it: #include <assert.h> #include <gtk/gtk.h> int main (int argc, char *argv[]) { gtk_init (&argc, &argv); GtkScrolledWindow *sw2 = g_object_new (GTK_TYPE_SCROLLED_WINDOW, NULL); printf ("hscrollbar = 0x%x\n", (int) sw2->hscrollbar); printf ("vscrollbar = 0x%x\n", (int) sw2->vscrollbar); }
Looks reasonably then.
Created attachment 239877 [details] [review] Remove redundant not-NULL checks from GtkScrolledWindow The scrollbars are created at construction time and there is no way to set them to NULL so remove the unnecessary NULL checks.
Attachment 239877 [details] pushed as a61a11a - Remove redundant not-NULL checks from GtkScrolledWindow
This commit has caused regression it tests: http://build.gnome.org/continuous/buildmaster/builds/2014/05/22/9/integrationtest/work-gnome-continuous-x86_64-runtime/installed-test-results/gtk+_a11ychildren.test/output.txt: (/usr/libexec/gtk+/installed-tests/children:16812): Gtk-CRITICAL **: gtk_range_get_adjustment: assertion 'GTK_IS_RANGE (range)' failed and some other tests
This was addressed in https://git.gnome.org/browse/gtk+/commit/?id=d01a291dbc051e8a92fadcf60e9a16423aea029a