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

connect error on QAxObject not handled

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.14.0 RC2
    • Active Qt
    • None
    • Windows 10
    • Windows

    Description

      Actual QT I have: QT 5.14.1

      I have a QAxObject* instance (custom local COM server) I a try to connect:

      const auto connection = connect(instance, SIGNAL(exception(int, const QString&, const QString&, const QString&)),
       SLOT(OnScannerException(int, const QString&, const QString& , const QString&)));

      I do this in order to detect possible COM errors internally reported by QT to the client.

      At the time I call that line the QAxObject instance, the underlying COM server of that is in an error state (The RPC server is unavailable) so I expect that the returned MetaObject::Connection

      will return false when evaluated to bool but that does not happen (I also won't receive any exception signal from instance to know that it is not available)

       

      If I debug QObject::connect source code I have this (see screenshot from Visual Studio, copy pasted code after all):

      // code placeholder
      QMetaObject::Connection QObject::connect(const QObject *sender, const char *signal,
                                           const QObject *receiver, const char *method,
                                           Qt::ConnectionType type)
      {
          if (sender == nullptr || receiver == nullptr || signal == nullptr || method == nullptr) {
              qWarning("QObject::connect: Cannot connect %s::%s to %s::%s",
                       sender ? sender->metaObject()->className() : "(nullptr)",
                       (signal && *signal) ? signal+1 : "(nullptr)",
                       receiver ? receiver->metaObject()->className() : "(nullptr)",
                       (method && *method) ? method+1 : "(nullptr)");
              return QMetaObject::Connection(0);
          }
          QByteArray tmp_signal_name;    if (!check_signal_macro(sender, signal, "connect", "bind"))
              return QMetaObject::Connection(0);
          const QMetaObject *smeta = sender->metaObject();

      when last line is called I see in debug view reported by QT library:

      ReturnHr(5) tid(298) 800706BA The RPC server is unavailable.

      This happens because in my case the COM server is disconnected/unavailable.

      The problem is that this error is not handled internally by QObject::connect and/or possibly for QAxObject to emit exception to it's targets so that I know that COM is down. 

      Because of this (not knowing the state of COM instance) I might get into other errors later - not sure if all subsequent COM accesses are guaranteed to not result in undefined behaviour.

      Attachments

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

        Activity

          People

            owolff Oliver Wolff
            ghita Gheorghe Marinca
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes