D25623: Fix crash when cups returns jobs with duplicate id

Albert Astals Cid noreply at phabricator.kde.org
Fri Nov 29 23:56:48 GMT 2019


aacid created this revision.
aacid added a reviewer: dantti.
Herald added a subscriber: kde-utils-devel.
aacid requested review of this revision.

REVISION 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
  
  BUGS: 414083

TEST PLAN
  Doesn't crash anymore with my weird cups list of pending jobs

REPOSITORY
  R363 Print Manager

BRANCH
  release/19.12

REVISION DETAIL
  https://phabricator.kde.org/D25623

AFFECTED FILES
  libkcups/JobModel.cpp
  libkcups/JobModel.h

To: aacid, dantti
Cc: kde-utils-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-utils-devel/attachments/20191129/5ac24c02/attachment.html>


More information about the Kde-utils-devel mailing list