After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 525206 - Remove superfluous non-NULL tests for the GtkScrolledWindow scrollbars
Remove superfluous non-NULL tests for the GtkScrolledWindow scrollbars
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkScrolledWindow
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-03-30 23:24 UTC by Björn Lindqvist
Modified: 2014-05-22 11:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Remove redundant not-NULL checks from GtkScrolledWindow (5.28 KB, patch)
2008-03-30 23:24 UTC, Björn Lindqvist
none Details | Review
New patch without color codes :) (4.00 KB, patch)
2008-03-30 23:52 UTC, Björn Lindqvist
reviewed Details | Review
Remove redundant not-NULL checks from GtkScrolledWindow (5.85 KB, patch)
2013-03-26 16:47 UTC, William Jon McCann
committed Details | Review

Description Björn Lindqvist 2008-03-30 23:24:00 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.
Comment 1 Björn Lindqvist 2008-03-30 23:24:49 UTC
Created attachment 108293 [details] [review]
Remove redundant not-NULL checks from GtkScrolledWindow
Comment 2 Björn Lindqvist 2008-03-30 23:52:21 UTC
Created attachment 108295 [details] [review]
New patch without color codes :)
Comment 3 Matthias Clasen 2008-05-25 04:03:33 UTC
Does g_object_new (GTK_TYPE_SCROLLED_WINDOW, NULL) set the scrollbars ?
Comment 4 Björn Lindqvist 2008-05-25 07:39:04 UTC
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);
}
Comment 5 Matthias Clasen 2010-08-05 04:41:16 UTC
Looks reasonably then.
Comment 6 William Jon McCann 2013-03-26 16:47:19 UTC
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.
Comment 7 Matthias Clasen 2014-05-22 03:04:59 UTC
Attachment 239877 [details] pushed as a61a11a - Remove redundant not-NULL checks from GtkScrolledWindow
Comment 8 Vadim Rutkovsky 2014-05-22 09:50:44 UTC
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
Comment 9 Vadim Rutkovsky 2014-05-22 11:35:39 UTC
This was addressed in https://git.gnome.org/browse/gtk+/commit/?id=d01a291dbc051e8a92fadcf60e9a16423aea029a