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

crash in QWindowsFileSystemWatcherEngine::addPaths

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 6.2.0 RC2
    • Fix Version/s: 6.2.0
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      Calling FileSystemWatcher::addPaths sometimes crashes with

      1   QHash<QFileSystemWatcherPathKey,QWindowsFileSystemWatcherEngine::PathInfo>::~QHash<QFileSystemWatcherPathKey,QWindowsFileSystemWatcherEngine::PathInfo> qhash.h                    776  0x7ffed19e0a32 
      2   QHashPrivate::Data<QHashPrivate::Node<void *,QHash<QFileSystemWatcherPathKey,QWindowsFileSystemWatcherEngine::PathInfo>>>::erase                        qhash.h                    649  0x7ffed19e308a 
      

      or

      1 QHash<void *,QHash<QFileSystemWatcherPathKey,QWindowsFileSystemWatcherEngine::PathInfo>>::emplace<QHash<QFileSystemWatcherPathKey,QWindowsFileSystemWatcherEngine::PathInfo> const &> qhash.h 1181 0x7ffe54dff9b6
      2 QWindowsFileSystemWatcherEngine::addPaths qfilesystemwatcher_win.cpp 434 0x7ffe54e0230e
      

      After a closer look at the code there is a problem with the path iterator pit in the method:
      QWindowsFileSystemWatcherEngine::addPaths ->

      Qt6 does not guarantee stable iterators after an insert.

      QHash<QString, int> myHash;
      auto i = myHash.find("foo");
      myHash.insert("foo", 789);
      i.value(); // possible crash
      myHash.erase(i); // possible crash
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              tjenssen Tim Jenssen
              Reporter:
              tjenssen Tim Jenssen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes