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

signal QFileSystemWatcher::fileChanged is no more emitted after 1 or 2 modifications of the file

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: 5.4.0
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Linux Ubuntu 14.04 LTS 64-bit

      Description

      An exemple is provided in attachement :
      I add the path of an existing file to an instance of FileSystemWatcher.
      I connect the signal fileChanged to a slot and set a debug message in the slot.

      The problem is visible with modification after the 2nd modification of the file. Step to reproduce :

      create a file file.txt
      run the program
      In console ==>add path "./file.txt"
      modify the file
      In console ==> file changed : "./file.txt"
      count path in watcher : 1
      modify the file
      In console ==> file changed : "./file.txt"
      count path in watcher : 0
      ==> Now the file is no more watched by the file watcher, it doesn't detect if the file is modified.

      The problem is visible with renaming or deleting the file after 1 modification :

      create a file file.txt
      run the program
      In console ==>add path "./file.txt"
      modify the file
      In console ==> file changed : "./file.txt"
      count path in watcher : 1
      delete or rename the file
      ==> the signal is not emmitted

      This is not corresponding to the documentation " Note that QFileSystemWatcher stops monitoring files once they have been renamed or removed from disk, and directories once they have been removed from disk." So in case of modification of the file, the watcher must continue to watch the file.

      Note : I have tested the signal directoryChanged. It seems to work :
      I create an other instance of FileSystem with the path of the directory that contains my file.
      I connect the signal directoryChanged.
      The slot is called when I rename, removed or modify myFile.

        Attachments

          Issue Links

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

            Activity

              People

              • Assignee:
                w00t Robin Burchell
                Reporter:
                deac Delphine Passinge
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes