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

Manually read a QML file from resource returns an empty file in release mode when QML compiler is active

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.11.0, 5.11.3, 5.12.0
    • Fix Version/s: 5.13.0 Alpha 1
    • Component/s: QML: Compiler
    • Environment:
      macOS High Sierra 10.13.6 and others
    • Platform/s:
      Android, Linux/X11, macOS
    • Commits:
      21ffde85a1b4592d24785a3ba82817de05486060

      Description

      Reading a QML file with QFile from a resource bundle returns an empty file in release mode on MacOS. 

      Testing the same code in debug mode works fine.

       

      for(auto fileName : {":/__initializer.qml", ":/__initializer.txt"}) {
          QFile f(fileName);
          if(f.open(QFile::ReadOnly))
             qDebug() << fileName << ":" << f.readAll(); 
      }
      // Output Debug:
      // :/__initializer.qml : "import QtQuick 2.0\nItem {\n    // Do nothing\n}\n"
      // :/__initializer.txt : "This is just a test message\n"
       
      // Output Release: 
      // :/__initializer.qml : ""
      // :/__initializer.txt : "This is just a test message\n"
      
      
      

      It looks like, it just happens on MacOS. Testing on Windows works fine. Cross compiling code for Android on MacOS shows the same behaviors as on MacOS. Compiling the code on Windows for Android works fine.

       

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              ulherman Ulf Hermann
              Reporter:
              yakin Sebastian Stadelmann
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes