DeleteLater() from within activex event handler



  • Hi everyone,

    I made a little modification to examples/activeqt/webbrowser example to show my question.

    Add QExample class declaration to webaxwidget.h.
    It does nothing but alert about deferred deletion of itself.

    @class QExample: public QObject {
    public:
    bool event(QEvent* e)
    {
    if (e->type() == QEvent::DeferredDelete)
    QMessageBox::information(0, "1", "DeferredDelete QExample");
    return QObject::event(e);
    }
    };@

    Add member to MainWindow class

    @class MainWindow : public QMainWindow, public Ui::MainWindow
    {
    ...
    public:
    QExample* ex;
    ...
    }@

    Its initialization

    @MainWindow::MainWindow()
    {
    ex = new QExample;
    ...
    }@

    And deleteLater() it from within NavigateComplete event handler.

    @void MainWindow::on_WebBrowser_NavigateComplete(QString)
    {
    ex->deleteLater();
    ...
    }@

    I expected it must be deleted after application returns to main event loop, but deletion occurs only after closing main window.
    Why?

    Qt 4.8.0 OS windows

    Thanks. Sorry for bad english.



  • 5 years later, I came across the same issue. Seems like Deferred deletion does not happen in activeqt.



  • @JulienMaille
    Good necro :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.