Git commit c93f2f16c30d10fbd0f4bfb4c0bf0cec07a4c93b by Albert Astals Cid.
Committed on 02/12/2019 at 22:05.
Pushed by aacid into branch 'release/19.12'.
Fix crash when cups returns jobs with duplicate id
Summary:
For some reason my cups was giving me two withheld jobs with id 33 and two with id 40
That made the JobModel code crash, because it went like this
* First job with id 33 found
* insertRow with 0 called
* Row 0 inserted
* Job at row 0 updated (from inside insertRow)
* Second job with id 33 found
* The "oh i already have this job code triggers", updates the job, then takesRow 0 and inserts at row 1. QStandardItemModel doesn't like getting a row add at 1 inserted when empty
* First job with id 40 found
* insertRow with 2 called
* Row 2 inserted, it fails, QStandardItemModel doesn't like getting a row add at 2 when empty
* Job at row 2 updated (from iniside insertRow)
* Crash because there's no row 2 in the model
Test Plan: Doesn't crash anymore with my weird cups list of pending jobs
Git commit c93f2f16c30d10f bd0f4bfb4c0bf0c ec07a4c93b by Albert Astals Cid.
Committed on 02/12/2019 at 22:05.
Pushed by aacid into branch 'release/19.12'.
Fix crash when cups returns jobs with duplicate id
Summary:
For some reason my cups was giving me two withheld jobs with id 33 and two with id 40
That made the JobModel code crash, because it went like this
* First job with id 33 found
* insertRow with 0 called
* Row 0 inserted
* Job at row 0 updated (from inside insertRow)
* Second job with id 33 found
* The "oh i already have this job code triggers", updates the job, then takesRow 0 and inserts at row 1. QStandardItemModel doesn't like getting a row add at 1 inserted when empty
* First job with id 40 found
* insertRow with 2 called
* Row 2 inserted, it fails, QStandardItemModel doesn't like getting a row add at 2 when empty
* Job at row 2 updated (from iniside insertRow)
* Crash because there's no row 2 in the model
Test Plan: Doesn't crash anymore with my weird cups list of pending jobs
Reviewers: dantti
Reviewed By: dantti
Subscribers: ngraham, marcelm, fvogt, broulik, nicolasfella, kmaterka, kde-utils-devel
Differential Revision: https:/ /phabricator. kde.org/ D25623
M +21 -2 libkcups/ JobModel. cpp
https:/ /commits. kde.org/ print-manager/ c93f2f16c30d10f bd0f4bfb4c0bf0c ec07a4c93b