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

QUrlList iterator becomes invalidated in drag enter event

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Not Evaluated
    • Resolution: Invalid
    • 5.8.0, 5.10
    • None
    • GUI: Drag and Drop
    • None
    • Fedora 25.

      QT 5.8 from QT Web installer.

      QT 5.10 build from source (github)

      gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)

    Description

      Example project here : https://github.com/conradjones/qt-list-crash

       

      Handling the drag enter event in a form when dragging from a treeview with file system model, crashes unless I copy the QUrlList locally, 

       

      
      // This crashes
          if (event->mimeData()->hasUrls()) {
              QList<QUrl>::iterator i = event->mimeData()->urls().begin();
              while (i != event->mimeData()->urls().end()) {
                  qDebug() << (*i).path()<< endl;
                  i++;
              }
          }
          // This does not
          if (event->mimeData()->hasUrls()) {
              QList<QUrl> urlList = event->mimeData()->urls();
              QList<QUrl>::iterator i = urlList.begin();
              while (i != urlList.end()) {
                  qDebug() << (*i).path()<< endl;
                  i++;
              }
          }
          // This does not
          if (event->mimeData()->hasUrls()) {
              QList<QUrl> urlList = event->mimeData()->urls();
              for (int i = 0; i < urlList.size(); ++i) {
                  qDebug() << urlList.at(i).path()<< endl;
              }
          }
      
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            conradjones Conrad Jones
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes