[gtkada] TestGtk "canvas" example ... problem?

Brian Drummond brian at shapes.demon.co.uk
Mon Sep 24 14:24:36 CEST 2012


If I try the "canvas" example in TestGTK, (under the "GtkAda demo" tab)
I can get it to crash easily and repeatably (about 70% of the time I
need to try the following operation only once...

Can anyone else reproduce the crash?
If not, then any problems are probably down to my non-standard build
environment and not worth discussing any further here.

(a) press "Add with Link -> Start"
At this point something drastically changes in the onscreen display and
scrollbar settings...

(b) Scroll to the very top and/or left. (This time, left).
Testgtk disappears.

If I start TestGTK from the command line and do this I see:
Execution terminated by unhandled exception
Exception name: CONSTRAINT_ERROR
Message: gtkada-canvas.adb:2497 overflow check failed
Call stack traceback locations:
0x73d1c1 0x73e513 0x73d913 0x7fa634f04722 0x7fa634f157ae 0x7fa634f1d349
0x7fa634f1d8c0 0x7fa636c3593c 0x7fa636b1ca7e 0x7fa63677146a
0x7fa636771411 0x7fa63676c435 0x7fa63676e5df 0x7fa63676e647
0x7fa63674c325 0x7fa634c46203 0x7fa634c46536 0x7fa634c46930
0x7fa636b1b795 0x6354c5 0x58c1fb 0x7fa634893eab 0x589353

A little digging points to create_canvas.adb line 541
541c562
          Add_Canvas_Link (Canvas, Item, Item, "0");
which adds a link from the new object to itself. 

Commenting this out, the object still has 2 other links to other objects
and the example works as expected. Adding some diagnostics shows that
the faulty line has the side-effect of increasing the drawing extents
reported by Get_Bounding_Box(Canvas, Width, Height) to approx 2**32, for
example 4.29E+09.

This might suggest some poorly sanitized type conversions from C code
but I have not dug any further.

There are also a few unrelated GTK warnings
(testgtk:6192): Gtk-WARNING **: GtkSpinButton: setting an adjustment
with non-zero page size is deprecated
which are easy to fix.

If anyone else can reproduce this, please say so, and I'll submit a
patch for the demo (but not the underlying problem)

- Brian





More information about the gtkada mailing list