Description
It seems like deleting a download's web page causes a crash in the web engine (I'm doing it to avoid leaving a blank tab open in my browser).
Reduced example:
connect(page->profile(), &QWebEngineProfile::downloadRequested, [](QWebEngineDownloadRequest *download) { download->page()->deleteLater(); });
Seems like something is trying to access a null pointer internally, here is the stack trace:
void doActivate<false>(QObject*, int, void**) 0x00007f9ea55a6a22 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) 0x00007f9ea559eeb7 QWebEnginePage::loadingChanged(QWebEngineLoadingInfo const&) 0x00007f9eabdb1579 QObject::event(QEvent*) 0x00007f9ea5597a6e QApplicationPrivate::notify_helper(QObject*, QEvent*) 0x00007f9eb1d87306 QCoreApplication::notifyInternal2(QObject*, QEvent*) 0x00007f9ea554477a QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) 0x00007f9ea5547e50 ::postEventSourceDispatch(GSource *, GSourceFunc, gpointer) 0x00007f9ea58112f7 g_main_context_dispatch 0x00007f9ea40b6d3b <unknown> 0x00007f9ea410c258 g_main_context_iteration 0x00007f9ea40b43e3 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 0x00007f9ea5810bee QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) 0x00007f9ea5550b7b QCoreApplication::exec() 0x00007f9ea554ccf6 main main_we.cpp:359 __libc_start_call_main 0x00007f9ea4c29d90 __libc_start_main_impl 0x00007f9ea4c29e40 _start 0x000055ea18b6a845
As a consequence, deleting the page after loadingChanged(LoadStoppedStatus) is received makes it work:
connect(page->profile(), &QWebEngineProfile::downloadRequested, [](QWebEngineDownloadRequest *download) { auto page = download->page(); connect(page, &QWebEnginePage::loadingChanged, [this, page] (const QWebEngineLoadingInfo &info) { if (info.status() == QWebEngineLoadingInfo::LoadStoppedStatus) { page->deleteLater(); } }); });