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

Windows: deleteLater() invoked from ActiveX callback/slot doesn't delete until the application terminates

    XMLWordPrintable

Details

    • c5d49725779292a04fed599eb7f508d334ffc5c3 (qtbase/dev, 12.2.2016, 5.7.0)

    Description

      As described at https://forum.qt.io/topic/15042/deletelater-from-within-activex-event-handler :

      1. Take the webbrowser example.
      2. Add a new class:
        class QExample : public QObject
        {
        public:
        	bool event(QEvent* e) override
        	{
        		if (e->type() == QEvent::DeferredDelete)
        			QMessageBox::information(0, "1", "DeferredDelete");
        		return QObject::event(e);
        	}
        };
      3. Add it to MainWindow:
        class MainWindow : public QMainWindow, public Ui::MainWindow
        {
        	...
        	QExample* ex;
        };
      4. Create it:
        MainWindow::MainWindow()
        {
        	ex = new QExample;
        	...
        }
      5. Request its deletion:
        void MainWindow::on_WebBrowser_NavigateComplete(const QString &url)
        {
        	ex->deleteLater();
        	...
        }

      The example object is expected to be deleted when the execution returns to the event loop, but it only happens when the browser is closed.


      A little background. I have an application that can be run both as a standalone executable and an ActiveX server. In the first mode, all is fine, but deleteLater()s don't properly work in the latter, the deferred-deleted objects basically leak during the application lifetime.

      Attachments

        1. qtbug45383_axcallback_stack.txt
          15 kB
        2. qtbug45383_diag_59.diff
          3 kB
        3. qtbug45383_diag.diff
          4 kB
        4. qtbug45383_log.txt
          5 kB
        5. qtbug45383_menu_invokation_log.txt
          5 kB
        6. qtbug45383_repro_4.diff
          2 kB
        7. qtbug45383_repro_5.diff
          2 kB
        8. qtbug45383.zip
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            paangele Paolo Angelelli
            blagodarin Sergei Blagodarin
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes