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

Methods that have argument of non-built-in type is not called correctly with argument in its custom namespace

    XMLWordPrintable

Details

    • Windows

    Description

      Reproducer attached. It contains an ActiveX server that adepts from Simple Example (ActiveQt) and an ActiveX container. The server is mostly identical to the example except one additional method:

          bool setSomethingComplicated(QSimpleAX *complicatedThing)
          {
              qInfo("I was called with a complicated thing.");
              return true;
          }
      

      which is the problem, i.e. its argument is of type QSimpleAX.

      To reproduce the issue, one need to:

      1. Build the server (/simple) and register it
      2. Run dumpcpp on the simpleax.exe and get a header and a source
      3. Copy the header and the source into container project (/usesimple) and do some modifications:
      4. In the header, remove all Qt types (QRect, QPoint, QSize, etc..) from namespace and replace all "simpleaxLib::QtType" with just ""QtType". That is by another bug: https://bugreports.qt.io/browse/QTBUG-134098
      5. Comment out everything related to method"setVisible". That is an ugly but quick fix for the problem that both ActiveQt and QWidget provide "setVisible" method - different but with the same name.
      6. Build and run the container

      First, one is going to see the dialog from "about()", which means QSimpleAx itself is largely fine. Then on will see an error:

      QAxBase: Error calling IDispatch member setSomethingComplicated: Type mismatch in parameter 0
      

      from "setSomethingComplicated()" method call.

      And the problem can be tracked down to qaxbase.cpp:

      That when Qt is doing "internalInvoke", the signature of the method is obtained as

      "setSomethingComplicated(QSimpleAX*)"
      

      which is clearly not true. The correct signature is:

      setSomethingComplicated(simpleaxLib::QSimpleAX*)
      

      So obviously, QSimplexAx is not wrapped in its custom namespace.

      And according to the original reporter that "qRegisterMetaType<simpleaxLib::QSimpleAX *>();" (but strangely not by Q_DECLARE_METATYPE) can help solve the problem (by uncommenting the "DEFINES += FIX_TYPEMISMATCH" in container.pro file). However, I can't make it work in either way.

      Attachments

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

        Activity

          People

            owolff Oliver Wolff
            luqiaochen Luqiao Chen
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes