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

Issue with openUrlExternally

    XMLWordPrintable

Details

    • Windows
    • ed114b728d9dc5265333c593254d9f6527464a60 (qt/qtbase/dev) 45d340851d5f88fb27fb7be011079fa1ae238a3f (qt/qtbase/5.15)

    Description

      Sometimes event is delivered to an application while the application is calling ShellExecute(). Most of the time this is probably not an issue, but for example, when the new delivered event causes destruction of what is calling it:

      12 static void qt_message_print(QtMsgType, const class QMessageLogContext
      & const, const class QString & const) Qt5Core.dll [qlogging.cpp : 1836
      + 0x19]
      13 static class QString qt_message(QtMsgType, const class QMessageLogContext
      & const, const char *, char *) Qt5Core.dll [qlogging.cpp : 373 + 0xd]
      14 QMessageLogger::fatal(char const *,...) Qt5Core.dll [qlogging.cpp : 885 +
      0x18]
      15 QQmlData::destroyed(QObject *) Qt5Qml.dll [qqmlengine.cpp : 1957 + 0x42]
      <SNIP>
      32 QQmlPrivate::QQmlElement<QQuickWindowQmlImpl>::`scalar deleting
      destructor'(unsigned int) Qt5Quick.dll + 0x4c
      33 QObject::event(QEvent *) Qt5Core.dll [qobject.cpp : 1251 + 0x17]
      34 QApplicationPrivate::notify_helper(QObject *,QEvent *) Qt5Widgets.dll
      [qapplication.cpp : 3700 + 0xc]
      35 QApplication::notify(QObject *,QEvent *) Qt5Widgets.dll [qapplication.cpp :
      3529 + 0xe]
      36 Application::notify(QObject *,QEvent *)
      App.exe [Application.cpp : 140 + 0xf]
      37 QCoreApplication::notifyInternal2(QObject *,QEvent *) Qt5Core.dll
      [qcoreapplication.cpp : 1088 + 0x13]
      38 QCoreApplicationPrivate::sendPostedEvents(QObject *,int,QThreadData *)
      Qt5Core.dll [qcoreapplication.cpp : 1825 + 0x19]
      39 qwindows.dll + 0x6354f
      40 qt_internal_proc(HWND__ *,unsigned int,unsigned __int64,__int64)
      Qt5Core.dll [qeventdispatcher_win.cpp : 245 + 0xc]
      <VARIOUS SHELL32.DLL FRAMES>
      64 qwindows.dll + 0xfcc30
      65 QDesktopServices::openUrl(QUrl const &) Qt5Gui.dll
      [qdesktopservices.cpp : 232 + 0xc]
      66 QV4::QtObject::method_openUrlExternally(QV4::FunctionObject const
      *,QV4::Value const *,QV4::Value const *,int) Qt5Qml.dll
      [qqmlbuiltinfunctions.cpp : 940 + 0x14]
      67 QV4::Moth::VME::interpret(QV4::CppStackFrame *,QV4::ExecutionEngine *,char
      const *) Qt5Qml.dll [qv4vme_moth.cpp : 738 + 0x1d]
      ...
      

      Seems that it might be possible to workaround this by using ShellExecuteEx with SEE_MASK_ASYNCOK set instead.

      public slots:
          void cppSlot(QVariant obj)
          {
              qDebug("MyObject::cppSlot");
              QObject* button = qvariant_cast<QObject *>(obj);
              QMetaObject::invokeMethod(this, [button]() {
                  qDebug() << __FUNCTION__ << "delete button";
                  delete button;
              }, Qt::QueuedConnection);
              QDesktopServices::openUrl(QUrl("https://qt.io/"));
          }
      

      produces

      MyObject::cppSlot
      MyObject::cppSlot::<lambda_b395a9bf7b216b133b634b5a744c72c2>::operator () delete button
      Object 0x2a8550f9110 destroyed while one of its QML signal handlers is in progress.
      Most likely the object was deleted synchronously (use QObject::deleteLater() instead), or the application is running a nested event loop.
      This behavior is NOT supported!
      qrc:/main.qml:17: function() { [native code] }
      

      Attachments

        1. OpenURLCrash.zip
          5 kB
        2. qtbug85676_dialog_nonrepro.diff
          3 kB
        3. qtbug85676_widgets.zip
          3 kB
        4. qtbug85676.zip
          2 kB

        Issue Links

          Activity

            People

              poikelin Joni Poikelin
              poikelin Joni Poikelin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: