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

When loading a qml module via a URL, qmldir files are parsed multiple times resulting in load failures

    XMLWordPrintable

Details

    • Linux/X11, Windows
    • 16683799681578d076c46b71f77d326ac304cc6e 220c1031fc3e0957c4d94c42d30fb33d1e023929

    Description

      This is true when loading from, e.g. http, but also via a custom scheme through a custom NetworkAccessManager.

      I was going to try to package a minimal example, but it looks like qmlscene doesn't support anything that depends on a network-loaded module (it checks if the component is ready and quits if not... in this case it's still loading).

      The gist is, if you have:

      import foo 1.0
      
      Foo {
      }
      

      where foo comes via a non-local URL, you get:

      file:http://localhost:8000/foo/qmldir:1: only one module identifier directive may be defined in a qmldir file
      

      This seems to boil down to

      bool QQmlTypeLoader::Blob::qmldirDataAvailable(QQmlQmldirData *data, QList<QQmlError> *errors)
      {
          bool resolve = true;     <--------- resolve defaults to true
      
          const QQmlScript::Import *import = data->import();
          data->setImport(0);
      
          int priority = data->priority();
          data->setPriority(0);
      
          if (import) {
              // Do we need to resolve this import?
              QHash<const QQmlScript::Import *, int>::iterator it = m_unresolvedImports.find(import);
              if (it != m_unresolvedImports.end()) {
                  resolve = (*it == 0) || (*it > priority);
              }
      <------------ if import is not in m_unresolvedImports, resolve is still true
      

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-30467
          # Subject Branch Project Status CR V

          Activity

            People

              ulherman Ulf Hermann
              jfaust Josh Faust
              Votes:
              5 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes