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

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.13.0 Alpha 1
    • 5.11.0, 5.11.3, 5.12.0
    • QML: Compiler
    • macOS High Sierra 10.13.6 and others
    • Android, Linux/X11, macOS
    • 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

        1. ReadFileFromResource_BuildDirs.zip
          154 kB
          Sebastian Stadelmann
        2. ReadFileFromResource.tgz
          1 kB
          Sebastian Stadelmann

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              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