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

[regression] Data is not written to file if QFile::size() is called before writing ends

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.11.2
    • 5.11.1
    • Core: I/O
    • None
    • Linux, Android (confirmed on many various devices and distros)
    • Android, Linux/X11
    • 04c57b68864cc8156d806959254de12f6cec47dc

    Description

      There is a serious regression in QFile/QTemporaryFile between Qt 5.9.5 (and all earlier versions) and Qt 5.11.1.

      Here is what I do:

      1. Open a QTemporaryFile and write some data to it.
      2. Call size() on that file.
      3. Open same file using QFile and write more data to it (using Append flag).
      4. Copy the temp file to some other place.

      Result:

      Copied file contains only data written in 1. - all subsequent writes are lost when using Qt 5.11.1. On older versions (tested with 5.9.5 and 5.5.1) all data is copied correctly.

      If I don't call size() (point 2), code works correctly and I see all the data on Qt 5.11.1. 

       

      I am not sure if QTemporaryFile has anything to do with the issue

      Attached:

      • main.cpp contains a minimal example
      • destination_good_595.txt contains data written by example when run with Qt 5.9.5
      • destination_bad_5111.txt contains data written by example when run with Qt 5.11.1

       

      Attachments

        1. destination_bad_5111.txt
          0.0 kB
        2. destination_good_595.txt
          4 kB
        3. main.cpp
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            sierdzio Tomasz Siekierda
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes