Strange interactions between Canvas item and DnD?

I am trying to use gtk's DnD functions to move a GnomeCanvasItem from
one canvas to another.  I placed source/dest DnD attributes on each
GnomeCanvas widget, then in each of the drag data get/drag data
received handlers, I find out which canvas item is being moved, and call
my own functions to recreate the canvas item in the new canvas and
destroy the old canvas item.  This is somehow putting the Canvas in an
unknown state, and eventually causes a seg fault.

One theory I had: when I initiate a drag on a canvas, internally the
canvas first calls the button_press handler for the canvas.  If there is
a canvas item underneath the mouse, the canvas button press is put on
hold, waiting for a button release.  Since the canvas item is destroyed
once the drag is complete, perhaps this is putting the canvas in an
uknown state.  This is the error I get:

GnomeCanvas-ERROR **: file gnome-canvas.c: line 3509 (gnome_canvas_request_update_real): assertion failed: (canvas->idle_id != 0)

I tested this theory by moving my move functions into a keypress event.
Pressing a key (instead of using the mouse with dnd) moves my items to
the other canvas.  Works like a charm.  I can move the item back and
forth without any canvas seg faults.

Is there anything special I need to do to get the Canvas to play nicely
with DnD?  


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