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

QFileSystemWatcher::fileChanged() on Windows doesn't trigger on flush()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.3.1
    • None
    • Windows 8.1, Visual Studio 2013

    Description

      I am using the QFileSystemWatcher to trace changes on files. Such files can be opened by another application which is appending a new data to them. The application flushes file stream after each append operation. File is only closed when application closes. It can't be closed after each entry, because it could harmfully impact on performance.
      The problem is that the signal QFileSystemWatcher::fileChanged() is only emitted when:

      • file is closed;
      • file is opened by another application (an example is refreshing directory containing that file in file explorator).

      Such problem doesn't occur on Unix-based systems. What is more the behavior I am expecting is intentional, as stated in comment:
      https://bugreports.qt-project.org/browse/QTBUG-8244?focusedCommentId=108330&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-108330

      Exploring Qt source code brings conclusion that QFileSystemWatcher is using last modification time as changing criterion and problem probably lies in different implementation of updating that time on Windows system. Is it possible to use additional criterion (like size of file) or use some system-specific functions ( http://msdn.microsoft.com/en-us/library/aa365465(VS.85).aspx , http://msdn.microsoft.com/en-us/library/aa364417(v=vs.85).aspx ) ?

      src\corelib\io\qfilesystemwatcher_win.cpp:401

      Attachments

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

        Activity

          People

            cnn Qt Core & Network
            srutownik Marek Wawrzos
            Votes:
            9 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes