Edit book: Fix crash that happens sometimes when deleting multiple files. Fixes #1263179 [Editor quits while deleting files with "delte" key](https://bugs.launchpad.net/calibre/+bug/1263179)

This commit is contained in:
Kovid Goyal 2013-12-20 23:46:47 +05:30
parent 57f6dcf579
commit f9ed3306ce

View File

@ -519,7 +519,9 @@ class FileList(QTreeWidget):
if unicode(child.data(0, NAME_ROLE).toString()) in other_removals:
removals.append(child)
for c in removals:
# The sorting by index is necessary otherwise Qt crashes with recursive
# repaint detected message
for c in sorted(removals, key=lambda x:x.parent().indexOfChild(x), reverse=True):
c.parent().removeChild(c)
def dropEvent(self, event):