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

QQmlComponent can no longer load local, relative URLs

    XMLWordPrintable

Details

    • 8836896dff45fe1d21736835845e36d03763117f

    Description

      The following example (full version has been attached) asserts on the dev branch, but not with 5.8:

      main.cpp
      #include <QGuiApplication>
      #include <QQmlComponent>
      #include <QQmlEngine>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication a(argc, argv);
      
          QQmlEngine e;
          QQmlComponent c(&e);
          c.loadUrl(QUrl::fromLocalFile("main.qml"));
          if (c.isError()) {
              qDebug() << "Failed to load main.qml:" << c.errorString();
              return 1;
          }
      
          qDebug() << "Success!";
          return 0;
      }
      
      main.qml
      import QtQuick 2.0
      
      Rectangle {
          width: 400
          height: 400
          color: "red"
      }
      
      ASSERT: "!url.isRelative() && (QQmlFile::urlToLocalFileOrQrc(url).isEmpty() || !QDir::isRelativePath(QQmlFile::urlToLocalFileOrQrc(url)))" in file /home/mitch/dev/qt5-dev/qtdeclarative/src/qml/qml/qqmltypeloader.cpp, line 1632
      

      The only related changes I see in the functions in the stack frames don't seem to have changed behaviour (d54f7f520ab876e86db3ddc895ddba7f685aec1d).

      Attachments

        Issue Links

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

          Activity

            People

              mitch_curtis Mitch Curtis
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes