Fix IndexError crash in work_process with multiple circular-descendant parents#5
Open
czxb7r wants to merge 1 commit into
Open
Conversation
When a work has two or more parents that are circular descendants, the removal loop iterated del_list via list(set(...)) (arbitrary order) and called parentIds.pop(i)/parents.pop(i). Each pop shrinks the list, so a later index becomes out of range -> IndexError: pop index out of range. Because this runs inside a QtNetwork reply slot, PyQt escalates the uncaught exception to qFatal()/abort() and Picard crashes. Pop in descending index order so earlier removals do not invalidate later indices. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Classical Extras crashes Picard (SIGABRT) while processing a release whose work hierarchy contains two or more circular parent references.
Reproduced with the work "Tannhäuser: Ouverture and Venusberg Music" (
d801c361-fcfa-4485-81b4-486154daf6bd), which has two parents that are circular descendants. The plugin correctly logsFound parent which is descendant of child - not using, to prevent circular references(twice), then dies:Because this runs inside a QtNetwork reply slot, PyQt escalates the uncaught exception to
qFatal()→abort(), taking the whole app down (no Python traceback shown in the GUI; just a crash).Observed on installed 2.0.14 and present on this branch (2.0.11).
Root cause
In
PartLevels.work_process, the circular-parent removal collects indices into the parallelparentIds/parentslists indel_list, then removes them with:setiteration order is arbitrary, and eachpop(i)shrinks the list, so once a second index is popped a later index is out of range. A single circular parent happens to work by luck; two or more reliably crash.Fix
Pop in descending index order so earlier removals don't invalidate later indices — one line:
Testing
With this change the same release tags through cleanly, the two circular parents are still correctly dropped and reported via
~cwp_error, and no crash occurs.Environment: Picard 2.13.3, Python 3.11.5, PyQt 5.15.11, macOS.