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

Q_PLUGIN_METADATA with invalid JSON fails with no indication why

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.9.4
    • Core: Plugins
    • None

    Description

      If you include invalid JSON in the Q_PLUGIN_METADATA, then the plugin will fail to load.

      Asking QPluginLoader for the errorString() just gives us:

        "<path>/foo.dylib is not a Qt plugin"

      This is very confusing to plugin developers because it's so easy to get JSON slightly wrong (extra commas!).

      Is there any way to find out that it failed because of invalid JSON? I don't think we would even need the actual error or the line number - just that this was the cause.

       

      Possible actions:

      1) Have it set the QPluginLoader error message to something more useful like "<path>/foo.dylib contains invalid meta data"

      2) Output a warning to the console if the loader encounters invalid meta data

      3) Load the plugin anyways and return empty meta data or a JSON file with an error message in it when it's asked for?

      4) <some other awesome solution>

       

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            asm Andy M
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes