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

crash in QWindowsFileSystemWatcherEngine::addPaths

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.2.0
    • 6.2.0 RC2
    • None
    • 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

              tjenssen Tim Jenssen
              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