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 721407 - Criticals on GtkScrolledWindow composite widget
Criticals on GtkScrolledWindow composite widget
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkBuilder
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GtkBuilder maintainers
GtkBuilder maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-03 16:46 UTC by Zeeshan Ali
Modified: 2014-01-05 15:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase (1000 bytes, application/x-xz)
2014-01-03 16:46 UTC, Zeeshan Ali
  Details
Ensure scrollbars at GtkContainerClass->add() time (1.20 KB, patch)
2014-01-04 03:00 UTC, Tristan Van Berkom
reviewed Details | Review

Description Zeeshan Ali 2014-01-03 16:46:28 UTC
Created attachment 265231 [details]
Testcase

With git master (commit eb6ae0d) of gtk+, if my composite widget is deriving from GtkScrolledWindow, I get following criticals at runtime:

(demo:17195): Gtk-CRITICAL **: gtk_range_get_adjustment: assertion 'GTK_IS_RANGE (range)' failed

(demo:17195): Gtk-CRITICAL **: gtk_range_get_adjustment: assertion 'GTK_IS_RANGE (range)' failed

Backtraces for both:

(demo:17287): Gtk-CRITICAL **: gtk_range_get_adjustment: assertion 'GTK_IS_RANGE (range)' failed

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff60c9c53 in _g_log_abort (breakpoint=1) at gmessages.c:309
309	    G_BREAKPOINT ();
(gdb) bt
  • #0 _g_log_abort
    at gmessages.c line 309
  • #1 g_logv
    at gmessages.c line 1041
  • #2 g_log
    at gmessages.c line 1079
  • #3 g_return_if_fail_warning
  • #4 gtk_range_get_adjustment
    at gtkrange.c line 773
  • #5 gtk_scrolled_window_add
    at gtkscrolledwindow.c line 2929
  • #6 g_cclosure_marshal_VOID__OBJECTv
    at gmarshal.c line 1312
  • #7 g_type_class_meta_marshalv
    at gclosure.c line 997
  • #8 _g_closure_invoke_va
    at gclosure.c line 840
  • #9 g_signal_emit_valist
    at gsignal.c line 3220
  • #10 g_signal_emit
    at gsignal.c line 3368
  • #11 gtk_container_add
    at gtkcontainer.c line 1552
  • #12 gtk_container_buildable_add_child
    at gtkcontainer.c line 567
  • #13 gtk_buildable_add_child
    at gtkbuildable.c line 137
  • #14 _gtk_builder_add
    at gtkbuilder.c line 879
  • #15 end_element
    at gtkbuilderparser.c line 1151
  • #16 emit_end_element
    at gmarkup.c line 1083
  • #17 g_markup_parse_context_parse
    at gmarkup.c line 1625
  • #18 _gtk_builder_parser_parse_buffer
    at gtkbuilderparser.c line 1285
  • #19 _gtk_builder_extend_with_template
    at gtkbuilder.c line 1141
  • #20 gtk_widget_init_template
    at gtkwidget.c line 15938
  • #21 my_widget_instance_init
  • #22 g_type_create_instance
    at gtype.c line 1868
  • #23 g_object_new_internal
    at gobject.c line 1727
  • #24 g_object_newv
    at gobject.c line 1871
  • #25 g_object_new
    at gobject.c line 1571
  • #26 my_widget_construct
  • #27 my_widget_new
  • #28 _vala_main
  • #29 main
  • #0 _g_log_abort
    at gmessages.c line 309
  • #1 g_logv
    at gmessages.c line 1041
  • #2 g_log
    at gmessages.c line 1079
  • #3 g_return_if_fail_warning
  • #4 gtk_range_get_adjustment
    at gtkrange.c line 773
  • #5 gtk_scrolled_window_add
    at gtkscrolledwindow.c line 2930
  • #6 g_cclosure_marshal_VOID__OBJECTv
    at gmarshal.c line 1312
  • #7 g_type_class_meta_marshalv
    at gclosure.c line 997
  • #8 _g_closure_invoke_va
    at gclosure.c line 840
  • #9 g_signal_emit_valist
    at gsignal.c line 3220
  • #10 g_signal_emit
    at gsignal.c line 3368
  • #11 gtk_container_add
    at gtkcontainer.c line 1552
  • #12 gtk_container_buildable_add_child
    at gtkcontainer.c line 567
  • #13 gtk_buildable_add_child
    at gtkbuildable.c line 137
  • #14 _gtk_builder_add
    at gtkbuilder.c line 879
  • #15 end_element
    at gtkbuilderparser.c line 1151
  • #16 emit_end_element
    at gmarkup.c line 1083
  • #17 g_markup_parse_context_parse
    at gmarkup.c line 1625
  • #18 _gtk_builder_parser_parse_buffer
    at gtkbuilderparser.c line 1285
  • #19 _gtk_builder_extend_with_template
    at gtkbuilder.c line 1141
  • #20 gtk_widget_init_template
    at gtkwidget.c line 15938
  • #21 my_widget_instance_init
  • #22 g_type_create_instance
    at gtype.c line 1868
  • #23 g_object_new_internal
    at gobject.c line 1727
  • #24 g_object_newv
    at gobject.c line 1871
  • #25 g_object_new
    at gobject.c line 1571
  • #26 my_widget_construct
  • #27 my_widget_new
  • #28 _vala_main
  • #29 main

I'm attaching a complete app which can be used to reproduce the issue.
Comment 1 Tristan Van Berkom 2014-01-04 03:00:48 UTC
Created attachment 265284 [details] [review]
Ensure scrollbars at GtkContainerClass->add() time

We normally dont have subclasses of GtkScrolledWindow adding composite children
at instance initialization time, this patch makes template subclassing possible
without interfering with the scrolled window's initialization.
Comment 2 Matthias Clasen 2014-01-04 19:10:51 UTC
Review of attachment 265284 [details] [review]:

::: gtk/gtkscrolledwindow.c
@@ +2931,3 @@
+
+  if (!priv->vscrollbar)
+    gtk_scrolled_window_set_vadjustment (scrolled_window, NULL);

This looks a little funny, since you are checking a scrollbar, but then set an adjustment. I think a little comment would be in order, like

/* gtk_scrolled_window_set_[hv]adjustment has the side-effect of creating
 * the scrollbars
 */
Comment 3 Zeeshan Ali 2014-01-04 21:47:41 UTC
(In reply to comment #1)
> Created an attachment (id=265284) [details] [review]
> Ensure scrollbars at GtkContainerClass->add() time

This patch fixes the issue for me, both in the attached test app and Boxes. Thanks for the quick action.
Comment 4 Zeeshan Ali 2014-01-05 15:26:18 UTC
So was the solution some modified version of attached patch here or something else? Would be nice for the record to update the status on the patch here and leave a short comment on the bug about the solution. `git-bz push` helps.
Comment 5 Tristan Van Berkom 2014-01-05 15:44:05 UTC
Zeeshan,

Matthias committed a modified version of my patch, which simply adds
the comment he suggested in his comment above.