I used to use Gtk::TreeView
to implement a "matrix" class of my own design. This worked perfectly and even for a large number of columns (> 250) there were never any problems. I have recently been replacing deprecated functions and thus have been trying to use the Gtk::ColumnView
class.
The following data structure is what I base my "matrix" class on. I have both an entry and a label (but only one is used at a time) so that I can set the matrix to be editable (and then use a Gtk::Entry
) or not editable (and then use a Gtk::Label
.
//
//Data structure to contain the internal data required to represent the
//cells in a matrix.
//
struct MatrixColumnView_Widget_Data
{
//
//The underlying entry field for the columns of the list store. It
//is stored as a vector and is only populated if the matrix is set
//to editable.
//
Gtk::Entry * i_entry;
//
//The underlying label field for the columns of the list store. It
//is stored as a vector and is only populated if the matrix is set
//to read only (ie not editable).
//
Gtk::Label * i_label;
//
//A flag to be used to indicate whether the validation function has
//been connected for this set of list store columns.
//
bool i_validation_function_set;
//
//Default constructor for the widget data structure. This constructor
//will reset all of the above fields to default values.
//
MatrixColumnView_Widget_Data()
{
i_entry = nullptr;
i_label = nullptr;
i_validation_function_set = false;
};
};
The following has worked fairly well for me in my other applications that I have successfully converted, but I have one application that has a "matrix editor" (I am trying to do the equivalent of the Windows DataGrid control), and it sets the number of columns to 250. I have tried smaller numbers (eg < 30) and it allows me to select a row or column without crashing. However if I use the larger value (which worked perfectly in a Gtk::TreeView
then the following assertion is displayed on the console:
** Gsk:ERROR:../../../gsk/gl/gskglrenderjob.c:2266:gsk_gl_render_job_visit_blurred_inset_shadow_node: code should not be reached Bail out! Gsk:ERROR:../../../gsk/gl/gskglrenderjob.c:2266:gsk_gl_render_job_visit_blurred_inset_shadow_node: code should not be reached Aborted
I have tried to obtain a backtrace in gdb but as I cannot locate any gtk debugging symbols it simply lists the gtk shared object library and some hex addresses which does not provide me with any help.
Has anybody ever seen or experienced the above ?
Is there any limits on how many columns are supported by a Gtk::ColumnView
?
Further Investigation Have just recompiled my application setting the maximum size of the matrix/columnview that it will create to 50 columns and I can successfully click on the cells and not crash with the above message.
Still does not solve my problem totally and does not explain why such a limit exists or how to code around it. So would appreciate any help that can be given.
Further Investigation After Locating Debugging Symbols I recently located the Debian repository that contained the GTK and GLIB debugging symbols and now include a proper backtrace in the hope that somebody reading this may see the problem that I cannot:
**
Gsk:ERROR:../../../gsk/gl/gskglrenderjob.c:2266:gsk_gl_render_job_visit_blurred_inset_shadow_node: code should not be reached
Bail out! Gsk:ERROR:../../../gsk/gl/gskglrenderjob.c:2266:gsk_gl_render_job_visit_blurred_inset_shadow_node: code should not be reached
#1 0x00007ffff6ea815f in __pthread_kill_internal
(signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 0x00007ffff6e5a472 in __GI_raise (sig=sig@entry=6)
at ../sysdeps/posix/raise.c:26
#3 0x00007ffff6e444b2 in __GI_abort () at ./stdlib/abort.c:79
#4 0x00007ffff74d8f18 in g_assertion_message
(domain=domain@entry=0x7ffff68f9faf "Gsk", file=file@entry=0x7ffff6920a48 "../../../gsk/gl/gskglrenderjob.c", line=line@entry=2266, func=func@entry=0x7ffff6997aa0 <__func__.17> "gsk_gl_render_job_visit_blurred_inset_shadow_node", message=message@entry=0x55555957e0a0 "code should not be reached")
at ../../../glib/gtestutils.c:3497
#5 0x00007ffff753feae in g_assertion_message_expr
(domain=domain@entry=0x7ffff68f9faf "Gsk", file=file@entry=0x7ffff6920a48 "../../../gsk/gl/gskglrenderjob.c", line=line@entry=2266, func=func@entry=0x7ffff6997aa0 <__func__.17> "gsk_gl_render_job_visit_blurred_inset_shadow_node", expr=expr@entry=0x0) at ../../../glib/gtestutils.c:3523
#6 0x00007ffff68c5289 in gsk_gl_render_job_visit_blurred_inset_shadow_node
(job=job@entry=0x55555f164ea0, node=node@entry=0x55555bbef5e0 [GskInsetShadowNode]) at ../../../gsk/gl/gskglrenderjob.c:2266
#7 0x00007ffff68c8f57 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=0x55555bbef5e0 [GskInsetShadowNode])
at ../../../gsk/gl/gskglrenderjob.c:4050
#8 0x00007ffff68c8016 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4019
#9 0x00007ffff68c8016 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4019
#10 0x00007ffff68cbb2a in gsk_gl_render_job_visit_transform_node
(job=0x55555f164ea0, node=0x55555ef94880 [GskTransformNode])
at ../../../gsk/gl/gskglrenderjob.c:2055
#11 0x00007ffff68c8a4e in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=0x55555ef94880 [GskTransformNode])
at ../../../gsk/gl/gskglrenderjob.c:4114
#12 0x00007ffff68c8016 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4019
#13 0x00007ffff68cbb2a in gsk_gl_render_job_visit_transform_node
(job=0x55555f164ea0, node=0x55555ef8c380 [GskTransformNode])
at ../../../gsk/gl/gskglrenderjob.c:2055
#14 0x00007ffff68c8a4e in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=0x55555ef8c380 [GskTransformNode])
at ../../../gsk/gl/gskglrenderjob.c:4114
#15 0x00007ffff68c8016 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4019
#16 0x00007ffff68cc7ee in gsk_gl_render_job_visit_clipped_child
(job=job@entry=0x55555f164ea0, child=0x55555ef89f90 [GskContainerNode], clip=clip@entry=0x55555ef89ff8) at ../../../gsk/gl/gskglrenderjob.c:1661
#17 0x00007ffff68c9066 in gsk_gl_render_job_visit_clip_node
(node=0x55555ef89fd0 [GskClipNode], job=0x55555f164ea0)
at ../../../gsk/gl/gskglrenderjob.c:1698
#18 gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=0x55555ef89fd0 [GskClipNode])
at ../../../gsk/gl/gskglrenderjob.c:3972
#19 0x00007ffff68c8016 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4019
#20 0x00007ffff68c8016 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4019
#21 0x00007ffff68c8016 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4019
#22 0x00007ffff68cbb2a in gsk_gl_render_job_visit_transform_node
(job=0x55555f164ea0, node=0x55555eeb2aa0 [GskTransformNode])
at ../../../gsk/gl/gskglrenderjob.c:2055
#23 0x00007ffff68c8a4e in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=0x55555eeb2aa0 [GskTransformNode])
at ../../../gsk/gl/gskglrenderjob.c:4114
#24 0x00007ffff68c8016 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4019
#25 0x00007ffff68cbb2a in gsk_gl_render_job_visit_transform_node
(job=0x55555f164ea0, node=0x55555ee8ac40 [GskTransformNode])
at ../../../gsk/gl/gskglrenderjob.c:2055
#26 0x00007ffff68c8a4e in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=0x55555ee8ac40 [GskTransformNode])
at ../../../gsk/gl/gskglrenderjob.c:4114
#27 0x00007ffff68c8016 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4019
#28 0x00007ffff68cbb2a in gsk_gl_render_job_visit_transform_node
(job=0x55555f164ea0, node=0x55555ef90600 [GskTransformNode])
at ../../../gsk/gl/gskglrenderjob.c:2055
#29 0x00007ffff68c8a4e in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=0x55555ef90600 [GskTransformNode])
at ../../../gsk/gl/gskglrenderjob.c:4114
#30 0x00007ffff68c8016 in gsk_gl_render_job_visit_node
(job=0x55555f164ea0, node=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4019
#31 0x00007ffff68cd71d in gsk_gl_render_job_render
(job=0x55555f164ea0, root=<optimized out>)
at ../../../gsk/gl/gskglrenderjob.c:4440
#32 0x00007ffff68a9ab3 in gsk_gl_renderer_render
(renderer=0x555558a95ca0 [GskGLRenderer], root=0x55555ef92490 [GskContainerNode], update_area=<optimized out>) at ../../../gsk/gl/gskglrenderer.c:314
#33 0x00007ffff688c2ee in gsk_renderer_render
(renderer=0x555558a95ca0 [GskGLRenderer], root=0x55555ef92490 [GskContainerNode], region=<optimized out>) at ../../../gsk/gskrenderer.c:460
#34 0x00007ffff668ad8d in gtk_widget_render
(widget=widget@entry=0x55555906a1f0 [gtkmm__GtkApplicationWindow], surface=0x5555559856c0 [GdkX11Toplevel], region=region@entry=0x5555591d7550)
at ../../../gtk/gtkwidget.c:11969
#35 0x00007ffff66923d9 in surface_render
(surface=<optimized out>, region=region@entry=0x5555591d7550, widget=widget@entry=0x55555906a1f0 [gtkmm__GtkApplicationWindow])
at ../../../gtk/gtkwindow.c:4804
#40 0x00007ffff6cc7243 in <emit signal 'render' on instance 0x5555559856c0 [GdkX11Toplevel]>
(instance=instance@entry=0x5555559856c0, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3675
#36 0x00007ffff680a538 in _gdk_marshal_BOOLEAN__BOXEDv
(closure=0x55555b8c9a40, return_value=0x7fffffff71e0, instance=<optimized out>, args=<optimized out>, marshal_data=<optimized out>, n_params=<optimized out>, param_types=0x555555a416a0) at gdk/gdkmarshalers.c:130
#37 0x00007ffff6cac749 in _g_closure_invoke_va
(closure=0x55555b8c9a40, return_value=0x7fffffff71e0, instance=0x5555559856c0, args=0x7fffffff72e0, n_params=1, param_types=0x555555a416a0)
at ../../../gobject/gclosure.c:895
#38 0x00007ffff6cc0913 in signal_emit_valist_unlocked
(instance=instance@entry=0x5555559856c0, signal_id=signal_id@entry=33, detail=detail@entry=0, var_args=var_args@entry=0x7fffffff72e0)
at ../../../gobject/gsignal.c:3516
#39 0x00007ffff6cc7186 in g_signal_emit_valist
(instance=0x5555559856c0, signal_id=33, detail=0, var_args=0x7fffffff72e0)
at ../../../gobject/gsignal.c:3355
#41 0x00007ffff687fc42 in gdk_surface_paint_on_clock
(clock=<optimized out>, data=0x5555559856c0)
at ../../../gdk/gdksurface.c:1377
#42 gdk_surface_paint_on_clock (clock=<optimized out>, data=0x5555559856c0)
at ../../../gdk/gdksurface.c:1353
#46 0x00007ffff6cc7243 in <emit signal 'paint' on instance 0x555555985cc0 [GdkFrameClockIdle]>
(instance=instance@entry=0x555555985cc0, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3675
#43 0x00007ffff6cac749 in _g_closure_invoke_va
(closure=0x55555968e290, return_value=0x0, instance=0x555555985cc0, args=0x7fffffff7670, n_params=0, param_types=0x0) at ../../../gobject/gclosure.c:895
#44 0x00007ffff6cc15bf in signal_emit_valist_unlocked
(instance=instance@entry=0x555555985cc0, signal_id=signal_id@entry=42, detail=detail@entry=0, var_args=var_args@entry=0x7fffffff7670)
at ../../../gobject/gsignal.c:3516
#45 0x00007ffff6cc7186 in g_signal_emit_valist
(instance=0x555555985cc0, signal_id=42, detail=0, var_args=0x7fffffff7670)
at ../../../gobject/gsignal.c:3355
#47 0x00007ffff686d969 in _gdk_frame_clock_emit_paint
(frame_clock=0x555555985cc0 [GdkFrameClockIdle])
at ../../../gdk/gdkframeclock.c:708
#48 0x00007ffff686e73e in gdk_frame_clock_paint_idle
(data=data@entry=0x555555985cc0) at ../../../gdk/gdkframeclockidle.c:632
#49 0x00007ffff686e804 in gdk_frame_clock_flush_idle (data=0x555555985cc0,
data@entry=<error reading variable: value has been optimized out>)
at ../../../gdk/gdkframeclockidle.c:400
#50 0x00007ffff751502e in g_timeout_dispatch
(source=0x5555592b93c0, callback=<optimized out>, user_data=<optimized out>) at ../../../glib/gmain.c:5121
#51 0x00007ffff75110d9 in g_main_dispatch
(context=context@entry=0x555555a543e0) at ../../../glib/gmain.c:3476
#52 0x00007ffff7514317 in g_main_context_dispatch_unlocked
(context=0x555555a543e0) at ../../../glib/gmain.c:4284
#53 g_main_context_iterate_unlocked
(context=context@entry=0x555555a543e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4349
#54 0x00007ffff7514930 in g_main_context_iteration
(context=context@entry=0x555555a543e0, may_block=may_block@entry=1)
at ../../../glib/gmain.c:4414
#55 0x00007ffff61b3b7d in g_application_run
(application=0x5555559b36b0 [gtkmm__GtkApplication], argc=1, argv=<optimized out>) at ../../../gio/gapplication.c:2577
#56 0x00007ffff7f41fd1 in My_Gtk::MyGtk::Application_Run(std::shared_ptr<Gtk::Application> const&, Gtk::Window*, int, char**, std::function<void (std::shared_ptr<Gtk::Application> const&, Gtk::Window*)>)
(app=std::shared_ptr<Gtk::Application> (use count 2, weak count 0) = {...}, window=<optimized out>, argc=1, argv=0x7fffffffd9d8, function=...)
at mygtk_1.cpp:712
#57 0x00007ffff7f42189 in My_Gtk::MyGtk::Application_Run(std::shared_ptr<Gtk::Application> const&, Gtk::Window*, int, char**)
(app=<error reading variable: Cannot access memory at address 0x2bcf>, window=0x2bc7, argc=6, argv=0x7ffff6ea80fc <__pthread_kill_implementation+268>)
at mygtk_1.cpp:662
#58 0x00005555556e32b0 in RPN_Calculator::RPN_MainWindow::RPN_MainWindow(int, char**) (this=0x7fffffff98d8, argc=1, argv=0x7fffffffd9d8)
at rpn_mainwindow_01.cpp:152
#59 0x00005555555796cb in main(int, char**) (argc=11207, argv=0x6)
at main.cpp:32
I have also, via trial and error, determined that 90 columns in the column view is the maximum which is too small for my requirements.