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

QList iterators validity differs from C++ standard

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.6.3
    • None
    • Qt 4.6.3 (official binaries)
      VS 2008 SP1
      Vista SP2

    Description

      When converting some code from std::list to QList I got some unexpected crashes. I found that the problem is that QList handles iterators validity in a non-conforming way (as per the C++ standard)

      I am attaching a file where you can see the different behaviour. In short: QList::clear() invalidates a stored QList::end() iterator, while the C++ standard says that the end() iterator should remain valid.

      See also my post on comp.lang.c++:
      http://groups.google.com/group/comp.lang.c++/browse_thread/thread/337e3a68868940f9#

      I am reporting this as a bug because I understand that the whole point of having iterators in QList is for C++ compatibility.

      Attachments

        1. main.cpp
          0.8 kB
        2. QtTest.zip
          0.9 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            biochimia João Abecasis
            mattc Matteo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes