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

qmlProtectModule() claims it "allows the engine to skip checking for a plugin when that uri is imported", but that might not be true

    XMLWordPrintable

Details

    • d0dc91158d0b44d9e1b73c3b0dacdd6699741ad7 (qt/qtdeclarative/dev) 3eece79ddbe110c9021ed9b9715c6fd4f70f3ca6 (qt/qtdeclarative/6.2)

    Description

      https://doc.qt.io/qt-5/qqmlengine.html#qmlProtectModule says:

      This function protects a module from having types registered into it. This can be used to prevent other plugins from injecting types into your module. It can also be a performance improvement, as it allows the engine to skip checking for the possibility of new types or plugins when this import is reached.

      The performance benefit is primarily seen when registering application specific types from within the application instead of through a plugin. Using qmlProtectModule allows the engine to skip checking for a plugin when that uri is imported, which can be noticeable with slow file systems.

      After this function is called, any attempt to register C++ types into this uri, major version combination will lead to a runtime error. Call this after you have registered all of your types with the engine.

      Returns true if the module with uri as a module identifier and majVersion as a major version number was found and locked, otherwise returns false. The module must contain exported types in order to be found.

      However, I've been told that this does not prevent loading the plugin, it just prevents the plugin from registering types.

      Attachments

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes