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

QList::swap causes QList entries to appear the same on subsequent query

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.6.3, 4.7.4, 4.8.6, 5.0.1, 5.1.1, 5.4.0
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Linux Mint 17 32-bit; Ubuntu 14.04; g++ Ubuntu 4.8.2-19ubuntu1

      Description

      This code:

        intersections = QList<QPointF>() << QPointF(1, 0) << QPointF(2, 0);
        intersections.swap(0, 1);
        qDebug() << intersections.at(0).x();
        qDebug() << intersections.at(1).x();
      

      causes the two entries to be identical in release mode, under some circumstances (outputs 1\n1 instead of 2\n1). This does not happen if one just puts qDebug() << "test" after the swap. It's not an issue with qDebug() because actual code that depends on the items behaves accordingly strange, too.

      Seems to not happen on Windows or Mac OS, at least according to this forum thread I've created beforehand (to make sure this isn't only a problem with my system): http://qt-project.org/forums/viewthread/51346

      Example project attached.

        Attachments

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

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            dermanu Emanuel Eichhammer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes