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:
Josip
2017-06-02 23:22:06 +02:00
committed by Nick Hall
parent 118e6c89e9
commit 6a4bd7dceb

View File

@@ -467,8 +467,21 @@ class GalleryTab(ButtonTab, DbGUIElement):
and decide if this is a move or a reorder.
"""
if sel_data and sel_data.get_data():
sel_list = []
try:
(mytype, selfid, obj, row_from) = pickle.loads(sel_data.get_data())
rets = pickle.loads(sel_data.get_data())
# single dnd item
if isinstance(rets, tuple):
sel_list.append(rets)
# multiple dnd items
elif isinstance(rets, list):
for ret in rets:
sel_list.append(pickle.loads(ret))
for sel in sel_list:
(mytype, selfid, obj, row_from) = sel
# make sure this is the correct DND type for this object
if mytype == self._DND_TYPE.drag_type: