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

[Qt5WebChannel] non-QVariant return types cause crash (regression)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.9.2
    • 5.9.0
    • WebChannel
    • None

    Description

      Inside of QMetaObjectPublisher::invokeMethod, there is code to check the return type for the method and set the returnValue to the proper QVariant. However, this return value is set after the QGenericReturnArgument returnArgument object is set up, causing a crash. This can most easily seen with a method that returns a QJsonObject for example.

      In previous versions of Qt the returnValue was checked and set up prior to the QGenericReturnArgument returnArgument object being created; reverting back to this order of operations fixes the issue.

      Old crashing code:

             QGenericReturnArgument returnArgument(method.typeName(), returnValue.data());
             if (method.returnType() != QMetaType::QVariant)
                  returnValue = QVariant(method.returnType(), 0);

      New working code:

           if (method.returnType() != QMetaType::QVariant)
                  returnValue = QVariant(method.returnType(), 0);
           QGenericReturnArgument returnArgument( method.typeName(), returnValue.data() );

       

       

      Attachments

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

        Activity

          People

            milianw Milian Wolff
            tcwilson tcwilson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes