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

error: cannot pass object of non-trivial type 'QtJniTypes::Context' through variadic function; call will abort at runtime

    XMLWordPrintable

Details

    • Android
    • 7d9cedec6 (dev), e08da3550 (6.7)
    • 2024wk16FOQtforAndroid

    Description

      The following code compiles fine with Qt 6.6.0:

      QJniObject getUriForFile(const QString &fileProvider, const QJniObject &java_io_File) 
      {
          return QJniObject::callStaticObjectMethod(
              "androidx/core/content/FileProvider",
              "getUriForFile",
              "(Landroid/content/Context;Ljava/lang/String;Ljava/io/File;)Landroid/net/Uri;",
              QNativeInterface::QAndroidApplication::context(),
              QJniObject::fromString(fileProvider).object(),
              java_io_File.object());
      }

      now it complains with:

      error: cannot pass object of non-trivial type 'QtJniTypes::Context' through variadic function; call will abort at runtime [-Wnon-pod-varargs]

      It seems it either picked a different overload or Qt6.7 has different flags, either way passing context is quite common, would be nice to have documented on how to do it now, my search didn't helped me much but seems I need to register this type, which again "maybe" should be done by Qt?

      Attachments

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

        Activity

          People

            assam Assam Boudjelthia
            dantti Daniel Nicoletti
            Votes:
            3 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes