[Kde-pim] Investigated: messagelist assert Q_ASSERT( newJob->currentIndex() <= newJob->endIndex() );

David Faure faure at kde.org
Fri Feb 24 12:02:10 GMT 2012


I hit that assert today, when simply going to the next email in my inbox IIRC.

However gdb is pretty clear as to why this is happening:

From messagelist/core/model.cpp:

4210│         // The change is completely above the job, the job is not 
affected
4211│       } else if( from > job->currentIndex() ) // and from <= job-
>endIndex()
4212│       {
4213│         // The change starts in the middle of the job in a way that it 
must be split in two.
4214│         // The first part is unaffected by the shift and ranges from job-
>currentIndex() to from - 1.
4215│         // We use the existing job for this.
4216│         job->setEndIndex( from - 1 );
4217│ 
4218│         Q_ASSERT( job->currentIndex() <= job->endIndex() );
4219│
At this point we have:
(gdb) p *job 
$5 = {
  mStartIndex = 643,
  mCurrentIndex = 643,
  mEndIndex = 7222,   (since from = 7223)
...
}


4219│
4220│         // The second part would range from "from" to job->endIndex() 
but must
4221│         // be shifted up by count. We add a new job for this.
4222│         ViewItemJob * newJob = new ViewItemJob( from + count, job-
>endIndex() + count, job->chunkTimeout(), job->idleInterval(), job-
>messageCheckCount() );

from + count = 7223 + 2408 = 9631
job->endIndex() + count = from - 1 + count = 9630

4224├>        Q_ASSERT( newJob->currentIndex() <= newJob->endIndex() );

(gdb) p *newJob
$9 = {
  mStartIndex = 9631,
  mCurrentIndex = 9631,
  mEndIndex = 9630,
   ...
}

This code should never work... (assert should hit every time), since the end 
index will always be one less than the start=current indexes.


-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list