Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50314

The const_iterator of containers(likes QList,QMap...etc) has a bug when it's empty

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.8.6
    • None
    • Microsoft Visual Stuidio 2008

    Description

      Just like:

      // an empty QList
      QList<int> lst;
      
      for(QList<int>::const_iterator iter = lst.constBegin(); iter != lst.end(); ++iter)
      {
      	qDebug() << *iter;
      }
      

      The code above cannot work and will lead to a crash, only because I use 'lst.end()' instead of 'lst.constEnd()'. But the problem disappers when the QList is not empty.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            tanaxiusi HongFei Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes