Custom gtkmm widget: X11 crashes when requesting invalid size

For some reason i’m developing widgets with fixed minimal and normal size. On the N-th widget, i forgot to initialize the size and when i ran the app the screen froze. There were other apps running. When i debugged the app with no other app running, X11 crashed and showed the login panel again.

1 Like

This is too little information for anyone to offer help.

Please provide more information ( sample code )

Thanks!

I have no simple example since all my widgets derives from a class that implements the common “Custom Widget” tasks and this, in turn, derives from some other class (for some reason) which, in turn, derives from Widget.

But in short, here is explained how to create a custom widget:

https://developer.gnome.org/gtkmm-tutorial/stable/sec-custom-widgets.html.en

Among the others, you need to implement these methods:

get_preferred_width_vfunc()
get_preferred_height_vfunc()
get_preferred_width_for_height_vfunc()
get_preferred_height_for_width_vfunc()

which return the normal and minimum sizes.

Now, i get the sizes from some variables (fields). When i forgot to initialize those variables, those functions returned undefined values and it seems that this made X11 crash, because as soon as i fixed the bug everything ran fine again.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.