Alright, I have tracked down the bug (I think). The things leading up to
the crash are:
1) change points attribute on the line
2) this causes the arrow polygons to be deleted, and an update is
scheduled to be run as a one off idle task (the update will recreate
the arrow heads).
3) The GnomeCanvasItem::point signal is emitted, which is used to deduce
how close an (x,y) coord is to this item. This is used to find out
which item was clicked on when an event occurs for the canvas.
4) Since the arrow polygon's were deleted, a seg fault occurs when the
polygon is accessed.
Here is a simpler example that will cause the crash:
--------------------------
from gtk import *
from gnome.ui import *
def crash_me(button, canvas, line):
line.set(points=(-1,1, 1,-1))
print "About to crash:"
print canvas.get_item_at(0, 0)
win = GtkWindow(WINDOW_TOPLEVEL)
win.set_title("Canvas Crash")
win.connect("destroy", mainquit)
vbox = GtkVBox(spacing=5)
win.add(vbox)
vbox.show()
canvas = GnomeCanvas()
canvas.set_usize(10, 10)
canvas.set_scroll_region(-1.5, -1.5, 1.5, 1.5)
vbox.pack_start(canvas)
canvas.show()
root = canvas.root()
line = root.add('line', points=(1,1, -1,-1),
last_arrowhead=TRUE,
arrow_shape_a=0.5,
arrow_shape_b=1.0, arrow_shape_c=0.5)
button = GtkButton("Crash Me")
button.connect("clicked", crash_me, canvas,
line)
vbox.pack_start(button, expand=FALSE)
button.show()
win.show()
mainloop()
--------------------------
And here is a patch to gnome-libs that will correct the problem:
Index: libgnomeui/gnome-canvas-line.c
===================================================================
RCS file: /cvs/gnome/gnome-libs/libgnomeui/gnome-canvas-line.c,v
retrieving revision 1.37
diff -u -r1.37 gnome-canvas-line.c
--- gnome-canvas-line.c 1999/01/18 17:50:16 1.37
+++ gnome-canvas-line.c 1999/05/25 04:12:17
@@ -1254,6 +1254,13 @@
best = dist;
}
+ /* sometimes the GnomeCanvasItem::update signal will not have
+ been processed between deleting the arrow points and a call
+ to this routine -- this can cause a segfault here */
+ if ((line->first_arrow && !line->first_coords) ||
+ (line->last_arrow && !line->last_coords))
+ reconfigure_arrows(line);
+
/* If there are arrowheads, check the distance to them */
if (line->first_arrow) {
I will apply this patch to the CVS tree, and it will go into
gnome-libs-1.0.10.
James Henstridge.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
On Mon, 24 May 1999, J.W. Bizzaro wrote:
> Sorry to be sending so many messages.
>
> It's the arrow head! I use an arrowhead on the parent's line. Apparently, when
> the line is very short (as when the child is over the parent) and the line has
> an arrowhead, something bombs.
>
> James, is this gnome or gnome-python that has this bug? If it's gnome, how can
> we report it?
>
>
> Jeff
>
>
>
> "J.W. Bizzaro" wrote:
> >
> > This is a newer version of my app:
> >
> > http://theopenlab.uml.edu/loci/download/loci-core-19990523.tar.gz
> >
> > Oh, and the new gnome canvas isn't slower. Netscape was just hogging processor
> > time again :-/
> >
> > Jeff
> >
> > "J.W. Bizzaro" wrote:
> > >
> > > James,
> > >
> > > I get a segmentation fault when using the gnome canvas in my program. It seems
> > > to occur when a group of canvas items is dragged over its parent group,
> > > especially when there are many items in a group. I get no Python traceback.
> > > Please take a look for yourself:
> > >
> > > http://theopenlab.uml.edu/loci/download/loci-core-19990521.tar.gz
> > >
> > > I just updated to gnome-python 1.0.3 and gnome-libs 1.0.9. The problem occurs
> > > with new and old versions.
> > >
> > > BTW, the canvas is a little slower with the new version, for some reason.
> > >
> > > Thanks.
> > > Jeff
> > > --
> > > J.W. Bizzaro mailto:[EMAIL PROTECTED]
> > > Boston College Chemistry http://www.uml.edu/Dept/Chem/Bizzaro/
> > > --
> > > To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
> >
> > --
> > J.W. Bizzaro mailto:[EMAIL PROTECTED]
> > Boston College Chemistry http://www.uml.edu/Dept/Chem/Bizzaro/
> > --
> > To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
>
> --
> J.W. Bizzaro mailto:[EMAIL PROTECTED]
> Boston College Chemistry http://www.uml.edu/Dept/Chem/Bizzaro/
> --
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
>
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]