<table><tr><td style="">aacid created this revision.<br />aacid added a reviewer: dantti.<br />Herald added a subscriber: kde-utils-devel.<br />aacid requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D25623">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>For some reason my cups was giving me two withheld jobs with id 33 and two with id 40</p>
<p>That made the JobModel code crash, because it went like this</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">First job with id 33 found</li>
<li class="remarkup-list-item">insertRow with 0 called</li>
<li class="remarkup-list-item">Row 0 inserted</li>
<li class="remarkup-list-item">Job at row 0 updated (from inside insertRow)</li>
<li class="remarkup-list-item">Second job with id 33 found</li>
<li class="remarkup-list-item">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</li>
<li class="remarkup-list-item">First job with id 40 found</li>
<li class="remarkup-list-item">insertRow with 2 called</li>
<li class="remarkup-list-item">Row 2 inserted, it fails, QStandardItemModel doesn't like getting a row add at 2 when empty</li>
<li class="remarkup-list-item">Job at row 2 updated (from iniside insertRow)</li>
<li class="remarkup-list-item">Crash because there's no row 2 in the model</li>
</ul>
<p>BUGS: 414083</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Doesn't crash anymore with my weird cups list of pending jobs</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R363 Print Manager</div></div></div><br /><div><strong>BRANCH</strong><div><div>release/19.12</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D25623">https://phabricator.kde.org/D25623</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>libkcups/JobModel.cpp<br />
libkcups/JobModel.h</div></div></div><br /><div><strong>To: </strong>aacid, dantti<br /><strong>Cc: </strong>kde-utils-devel<br /></div>