[LIBART] possible libart uta_vpath bug



Hello,

I wrote the attached event code for an ellipse item that I would
like to be able to drag around the gnome canvas.

The dragging works for a while, but if I drag the item around
continuously, for maybe thirty seconds to one minute (this varies quite a
bit) the application eventually segfaults. I've attached a backtrace from
gdb.

Is this a problem with the art_uta_vpath code, or should I be handling the
event differently, or both?

Thanks,
Tom

static gint
ellipse_event (GnomeCanvasItem *item, GdkEvent *event)
{
    static gint button_down = FALSE;
    static gdouble startx;
    static gdouble starty;
    gdouble relx;
    gdouble rely;
    gdouble wwx;
    gdouble wwy;
    
    g_return_val_if_fail(item != NULL, FALSE);
    g_return_val_if_fail(item->canvas != NULL, FALSE);
    g_return_val_if_fail(event != NULL, FALSE);

    switch(event->type)
    {
        case GDK_BUTTON_PRESS:
            startx = ((GdkEventButton *)event)->x;
            starty = ((GdkEventButton *)event)->y;

            gnome_canvas_c2w (item->canvas,
                              (int)startx,
                              (int)starty,
                              &startx,
                              &starty);
            
            gnome_canvas_item_w2i (item,
                                   &startx,
                                   &starty);

            button_down = TRUE;
            break;
        case GDK_MOTION_NOTIFY:
            if(button_down == TRUE)
            {
                relx = ((GdkEventMotion *)event)->x - startx;
                rely = ((GdkEventMotion *)event)->y - starty;
                
                gnome_canvas_c2w (item->canvas,
                                  (int) relx, (int) rely,
                                  &wwx, &wwy);
                
                gnome_canvas_item_w2i (item,
                                       &wwx, &wwy);

                gnome_canvas_item_move (item,
                                        wwx,
                                        wwy);
            }
            break;
        case GDK_BUTTON_RELEASE:
            button_down = FALSE;
            break;
        default:
            return FALSE;
            break;
    }
                
    return TRUE;
}
Program received signal SIGSEGV, Segmentation fault.
art_uta_add_line (uta=0x80a5fb8, x0=-160, y0=160, x1=-159.93784606094613, y1=64, rbuf=0x80a5478, rbuf_rowstride=4)
    at art_uta_vpath.c:241
241		      bb = uta->utiles[ix];
(gdb) bt
#0  art_uta_add_line (uta=0x80a5fb8, x0=-160, y0=160, x1=-159.93784606094613, y1=64, rbuf=0x80a5478, rbuf_rowstride=4)
    at art_uta_vpath.c:241
#1  0x402613f3 in art_uta_from_vpath (vec=0x80a9bf0) at art_uta_vpath.c:323
#2  0x402614fe in art_uta_from_svp (svp=0x80a2988) at art_uta_svp.c:49
#3  0x400946f0 in gnome_canvas_update_svp (canvas=0x8086410, p_svp=0x809e23c, new_svp=0x80a2988) at gnome-canvas-util.c:440
#4  0x400947e8 in gnome_canvas_item_update_svp (item=0x809e1b8, p_svp=0x809e23c, new_svp=0x80a2988) at gnome-canvas-util.c:505
#5  0x400948af in gnome_canvas_item_update_svp_clip (item=0x809e1b8, p_svp=0x809e23c, new_svp=0x80a2988, clip_svp=0x0)
    at gnome-canvas-util.c:542
#6  0x40090358 in gnome_canvas_ellipse_update (item=0x809e1b8, affine=0xbffff5c0, clip_path=0x0, flags=2)
    at gnome-canvas-rect-ellipse.c:1197
#7  0x40083770 in gnome_canvas_item_invoke_update (item=0x809e1b8, affine=0xbffff740, clip_path=0x0, flags=1)
    at gnome-canvas.c:497
#8  0x40085a09 in gnome_canvas_group_update (item=0x8092ce0, affine=0xbffff740, clip_path=0x0, flags=1) at gnome-canvas.c:1745
#9  0x40083770 in gnome_canvas_item_invoke_update (item=0x8092ce0, affine=0xbffff840, clip_path=0x0, flags=0)
    at gnome-canvas.c:497
#10 0x400889fa in do_update (canvas=0x8086410) at gnome-canvas.c:3354
#11 0x40088afa in idle_handler (data=0x8086410) at gnome-canvas.c:3380
#12 0x40472ff0 in g_idle_dispatch (source_data=0x40088aa4, dispatch_time=0xbffff950, user_data=0x8086410) at gmain.c:1367
#13 0x40472055 in g_main_dispatch (dispatch_time=0xbffff950) at gmain.c:656
#14 0x40472659 in g_main_iterate (block=1, dispatch=1) at gmain.c:877
#15 0x404727e8 in g_main_run (loop=0x80a1928) at gmain.c:935
#16 0x4033865b in gtk_main () at gtkmain.c:524
#17 0x08049bdd in main (argc=3, argv=0xbffffa4c) at ../../current-Gimchi/src/gimchi.c:50
#18 0x40538177 in __libc_start_main (main=0x8049af8 <main>, argc=3, ubp_av=0xbffffa4c, init=0x8049284 <_init>, 
    fini=0x804a0f0 <_fini>, rtld_fini=0x4000e184 <_dl_fini>, stack_end=0xbffffa3c) at ../sysdeps/generic/libc-start.c:129


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]