Crash after dragging multiple items from clipboard to gallery
I copied 7 items from the Media List to the clipboard. I then opened a Person, and dragged one Media Item to the Gallery. I then clicked and dragged to highlight the remaining 6 items at once. On dragging them to the gallery, it crashed. 2989475: ERROR: grampsapp.py: line 145: Unhandled exception Traceback (most recent call last): File "C:\Program Files\GrampsAIO64-4.2.5\gramps\gui\editors\displaytabs\gallerytab.py", line 475, in drag_data_received (mytype, selfid, obj, row_from) = pickle.loads(sel_data.get_data()) ValueError: too many values to unpack (expected 4) Fixes #9984.
This commit is contained in:
@@ -467,42 +467,55 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
|||||||
and decide if this is a move or a reorder.
|
and decide if this is a move or a reorder.
|
||||||
"""
|
"""
|
||||||
if sel_data and sel_data.get_data():
|
if sel_data and sel_data.get_data():
|
||||||
|
sel_list = []
|
||||||
try:
|
try:
|
||||||
(mytype, selfid, obj, row_from) = pickle.loads(sel_data.get_data())
|
rets = pickle.loads(sel_data.get_data())
|
||||||
|
|
||||||
# make sure this is the correct DND type for this object
|
# single dnd item
|
||||||
if mytype == self._DND_TYPE.drag_type:
|
if isinstance(rets, tuple):
|
||||||
|
sel_list.append(rets)
|
||||||
|
|
||||||
# determine the destination row
|
# multiple dnd items
|
||||||
data = self.iconlist.get_dest_item_at_pos(x, y)
|
elif isinstance(rets, list):
|
||||||
if data:
|
for ret in rets:
|
||||||
(path, pos) = data
|
sel_list.append(pickle.loads(ret))
|
||||||
row = path.get_indices()[0]
|
|
||||||
if pos == Gtk.IconViewDropPosition.DROP_LEFT:
|
|
||||||
row = max(row, 0)
|
|
||||||
elif pos == Gtk.IconViewDropPosition.DROP_RIGHT:
|
|
||||||
row = min(row, len(self.get_data()))
|
|
||||||
elif pos == Gtk.IconViewDropPosition.DROP_INTO:
|
|
||||||
row = min(row+1, len(self.get_data()))
|
|
||||||
else:
|
|
||||||
row = len(self.get_data())
|
|
||||||
|
|
||||||
# if the is same object, we have a move, otherwise,
|
for sel in sel_list:
|
||||||
# it is a standard drag-n-drop
|
(mytype, selfid, obj, row_from) = sel
|
||||||
|
|
||||||
if id(self) == selfid:
|
# make sure this is the correct DND type for this object
|
||||||
self._move(row_from, row, obj)
|
if mytype == self._DND_TYPE.drag_type:
|
||||||
else:
|
|
||||||
self._handle_drag(row, obj)
|
# determine the destination row
|
||||||
self.rebuild()
|
data = self.iconlist.get_dest_item_at_pos(x, y)
|
||||||
elif mytype == DdTargets.MEDIAOBJ.drag_type:
|
if data:
|
||||||
oref = MediaRef()
|
(path, pos) = data
|
||||||
oref.set_reference_handle(obj)
|
row = path.get_indices()[0]
|
||||||
self.get_data().append(oref)
|
if pos == Gtk.IconViewDropPosition.DROP_LEFT:
|
||||||
self.changed = True
|
row = max(row, 0)
|
||||||
self.rebuild()
|
elif pos == Gtk.IconViewDropPosition.DROP_RIGHT:
|
||||||
elif self._DND_EXTRA and mytype == self._DND_EXTRA.drag_type:
|
row = min(row, len(self.get_data()))
|
||||||
self.handle_extra_type(mytype, obj)
|
elif pos == Gtk.IconViewDropPosition.DROP_INTO:
|
||||||
|
row = min(row+1, len(self.get_data()))
|
||||||
|
else:
|
||||||
|
row = len(self.get_data())
|
||||||
|
|
||||||
|
# if the is same object, we have a move, otherwise,
|
||||||
|
# it is a standard drag-n-drop
|
||||||
|
|
||||||
|
if id(self) == selfid:
|
||||||
|
self._move(row_from, row, obj)
|
||||||
|
else:
|
||||||
|
self._handle_drag(row, obj)
|
||||||
|
self.rebuild()
|
||||||
|
elif mytype == DdTargets.MEDIAOBJ.drag_type:
|
||||||
|
oref = MediaRef()
|
||||||
|
oref.set_reference_handle(obj)
|
||||||
|
self.get_data().append(oref)
|
||||||
|
self.changed = True
|
||||||
|
self.rebuild()
|
||||||
|
elif self._DND_EXTRA and mytype == self._DND_EXTRA.drag_type:
|
||||||
|
self.handle_extra_type(mytype, obj)
|
||||||
except pickle.UnpicklingError:
|
except pickle.UnpicklingError:
|
||||||
files = sel_data.get_uris()
|
files = sel_data.get_uris()
|
||||||
for file in files:
|
for file in files:
|
||||||
|
Reference in New Issue
Block a user