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

QSaveFile fails to save a file on Windows, when it is being watched for changes.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.6, 5.8
    • Core: I/O
    • None
    • Windows Server 2012 R2, Qt compiled with MSVC.

    Description

      I have several applications written in Haskell that monitor changes to sources I'm working on and recompile them on save.

       

      When I start such application and try to edit&save a source from KDE Kate, I get an error telling me it has fail to save. I've tracked this down to `qfsfileengine_win.cpp:551`:

        

      bool ret = ::MoveFileEx((wchar_t*)d->fileEntry.nativeFilePath().utf16(), (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(), MOVEFILE_REPLACE_EXISTING) != 0;
      

      This return false in my case, and `GetLastError()` says `32`, which means

      ERROR_SHARING_VIOLATION
      32 (0x20)
      The process cannot access the file because it is being used by another process.

      I guess, when other application watches a file, this function doesn't work.

      Attachments

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

        Activity

          People

            dfaure_kdab David Faure
            arrowd Gleb Popov
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes