QupZilla / qupzilla

Cross-platform Qt web browser
http://www.qupzilla.com
GNU General Public License v3.0
1.11k stars 350 forks source link

Unload tab crash #2582

Closed ghost closed 6 years ago

ghost commented 6 years ago

Trying to unload tab when an html5 video plays on it, make QupZilla crashes. Crash-2018-01-31T10:25:16.txt gdb.log

nowrep commented 6 years ago

Please give me some testing url.

ghost commented 6 years ago

I think it is reproducible on any video page, i used this one: https://www.quirksmode.org/html5/tests/video.html

ghost commented 6 years ago

@nowrep I can't reproduce it with latest Appimage, so perhaps it is specific for „my Qt“ again!?

nowrep commented 6 years ago

Probably not.

nowrep commented 6 years ago

So it crashes with Qt 5.9.3 but not with Qt 5.10 (AppImage)? I can't reproduce it myself with Qt 5.10 either, and from the backtrace it really looks like bug in QtWebEngine rather than QupZilla.

ghost commented 6 years ago

So you may consider closing the issue. I will try again right i switch to Qt 5.10 (that probably will not be so soon :-))

SGOrava commented 6 years ago

I tried this on ArchLinux (qupzilla 2.2.5, qt 5.10...) and there is no crash. I opened video on youtube, it stared playing, i unloaded tab, no crash. I did not try latest git version.

ghost commented 6 years ago

@nowrep, just to confirm: i'm still reproducing that with 5.10.1 I did it 5 times of 5 here, but if you still can't reproduce it, you may just close the issue. The back trace looks similar: gdb.log

Terminal output ``` [14895:14902:0221/155601.617974:ERROR:nss_ocsp.cc(613)] No URLRequestContext for NSS HTTP handler. host: ocsp.digicert.com [14895:14902:0221/155601.618117:ERROR:nss_ocsp.cc(613)] No URLRequestContext for NSS HTTP handler. host: ocsp.digicert.com [14895:14902:0221/155601.618233:ERROR:nss_ocsp.cc(613)] No URLRequestContext for NSS HTTP handler. host: crl4.digicert.com [14895:14902:0221/155601.622479:ERROR:nss_ocsp.cc(613)] No URLRequestContext for NSS HTTP handler. host: ocsp.digicert.com [14895:14902:0221/155601.622542:ERROR:nss_ocsp.cc(613)] No URLRequestContext for NSS HTTP handler. host: ocsp.digicert.com [14895:14902:0221/155601.622667:ERROR:nss_ocsp.cc(613)] No URLRequestContext for NSS HTTP handler. host: crl4.digicert.com Received signal 11 SEGV_MAPERR 0000000000a8 #0 0x7fdd5db48cc7 #1 0x7fdd5c912b5e #2 0x7fdd5db4906d #3 0x7fdd5a1525e0 #4 0x7fdd5a789700 #5 0x7fdd5c9aebb8 QtWebEngineCore::WebContentsAdapter::activeUrl() #6 0x7fdd62f59677 QWebEnginePage::url() #7 0x7fdd62f64cf7 QWebEngineView::url() #8 0x7fdd62827ba6 AdBlockIcon::blockedRequestsChanged() #9 0x7fdd5a8528a3 QMetaObject::activate() #10 0x7fdd62a0d305 AdBlockManager::blockedRequestsChanged() #11 0x7fdd6281ecf1 AdBlockPlugin::webPageDeleted() #12 0x7fdd5a8528a3 QMetaObject::activate() #13 0x7fdd62a1a702 PluginProxy::webPageDeleted() #14 0x7fdd629ed79a WebPage::~WebPage() #15 0x7fdd629ed7e9 WebPage::~WebPage() #16 0x7fdd5a853858 QObject::event() #17 0x7fdd5b73d4bc QApplicationPrivate::notify_helper() #18 0x7fdd5b744b58 QApplication::notify() #19 0x7fdd5a829986 QCoreApplication::notifyInternal2() #20 0x7fdd5a82c633 QCoreApplicationPrivate::sendPostedEvents() #21 0x7fdd5bf26e74 #22 0x7fdd5bf270e0 QQuickRenderControl::~QQuickRenderControl() #23 0x7fdd62ddd923 #24 0x7fdd62ddbeeb #25 0x7fdd62ddbf69 #26 0x7fdd5a85a6d3 QObject::~QObject() #27 0x7fdd5b77723d QWidget::~QWidget() #28 0x7fdd62f6830f #29 0x7fdd5c991e52 #30 0x7fdd5c9920a9 #31 0x7fdd5d16aeb2 #32 0x7fdd5d15fd74 #33 0x7fdd5cfa8501 #34 0x7fdd5cfdd88d #35 0x7fdd5cfde0e9 #36 0x7fdd5cfe57ad #37 0x7fdd5cfab654 #38 0x7fdd5cfa63da #39 0x7fdd5d238a92 #40 0x7fdd5d238f49 #41 0x7fdd5c9ae938 #42 0x7fdd5c9aea2a QtWebEngineCore::WebContentsAdapter::~WebContentsAdapter() #43 0x7fdd62f573ee #44 0x7fdd62f57409 #45 0x7fdd62f56403 QWebEnginePage::~QWebEnginePage() #46 0x7fdd62f56429 QWebEnginePage::~QWebEnginePage() #47 0x7fdd62f64aea #48 0x7fdd629ff560 WebView::setPage() #49 0x7fdd62a06208 TabbedWebView::setPage() #50 0x7fdd62a08f7d WebTab::unload() #51 0x7fdd62a1ff8b TabWidget::qt_static_metacall() #52 0x7fdd5a852227 QMetaObject::activate() #53 0x7fdd62a208b1 TabContextMenu::unloadTab() #54 0x7fdd5a852227 QMetaObject::activate() #55 0x7fdd5b736e72 QAction::triggered() #56 0x7fdd5b7398ad QAction::activate() #57 0x7fdd5b8b9ad2 #58 0x7fdd5b8c0977 #59 0x7fdd5b8c18ab QMenu::mouseReleaseEvent() #60 0x7fdd5b77c205 QWidget::event() #61 0x7fdd5b8c3cb3 QMenu::event() r8: 0000000000000000 r9: 00000000016a1590 r10: 0000000000000003 r11: 00007fdd62a1a6c0 r12: 0000000006c98810 r13: 00007fdd5aa8adc8 r14: 000000000193e990 r15: 00007fdd62d78fc0 di: 00007ffd791b2f20 si: 00000000000000a8 bp: 0000000006c987d0 bx: 00007ffd791b2f20 dx: 0000000000000000 ax: 0000000006c989f0 cx: 00007ffd791b3080 sp: 00007ffd791b2ed8 ip: 00007fdd5a789700 efl: 0000000000010202 cgf: 0000000000000033 erf: 0000000000000004 trp: 000000000000000e msk: 0000000000000000 cr2: 00000000000000a8 [end of stack trace] Calling _exit(1). Core file will not be generated. [15046:15046:0100/000000.254359:ERROR:broker_posix.cc(43)] Invalid node channel message [15047:15047:0100/000000.254359:ERROR:broker_posix.cc(43)] Invalid node channel message ```
nowrep commented 6 years ago

@cranes-bill What about this:

diff --git a/src/lib/tabwidget/tabbar.cpp b/src/lib/tabwidget/tabbar.cpp
index 4c8c8056..97a78c73 100644
--- a/src/lib/tabwidget/tabbar.cpp
+++ b/src/lib/tabwidget/tabbar.cpp
@@ -348,14 +348,13 @@ void TabBar::contextMenuEvent(QContextMenuEvent* event)

     int index = tabAt(event->pos());

-    TabContextMenu menu(index, m_window);
+    TabContextMenu *menu = new TabContextMenu(index, m_window);
+    menu->setAttribute(Qt::WA_DeleteOnClose);

     // Prevent choosing first option with double rightclick
     const QPoint pos = event->globalPos();
     QPoint p(pos.x(), pos.y() + 1);
-    menu.exec(p);
-
-    m_window->action(QSL("Other/RestoreClosedTab"))->setEnabled(true);
+    menu->popup(p);
 }

 void TabBar::hideCloseButton(int index)
ghost commented 6 years ago
The same ``` Received signal 11 SEGV_MAPERR 0000000000a8 #0 0x7fce99e31cc7 #1 0x7fce98bfbb5e #2 0x7fce99e3206d #3 0x7fce9643b5e0 #4 0x7fce96a72700 #5 0x7fce98c97bb8 QtWebEngineCore::WebContentsAdapter::activeUrl() #6 0x7fce9f242677 QWebEnginePage::url() #7 0x7fce9f24dcf7 QWebEngineView::url() #8 0x7fce9eb10ba6 AdBlockIcon::blockedRequestsChanged() #9 0x7fce96b3b8a3 QMetaObject::activate() #10 0x7fce9ecf6255 AdBlockManager::blockedRequestsChanged() #11 0x7fce9eb07cf1 AdBlockPlugin::webPageDeleted() #12 0x7fce96b3b8a3 QMetaObject::activate() #13 0x7fce9ed03652 PluginProxy::webPageDeleted() #14 0x7fce9ecd66ea WebPage::~WebPage() #15 0x7fce9ecd6739 WebPage::~WebPage() #16 0x7fce96b3c858 QObject::event() #17 0x7fce97a264bc QApplicationPrivate::notify_helper() #18 0x7fce97a2db58 QApplication::notify() #19 0x7fce96b12986 QCoreApplication::notifyInternal2() #20 0x7fce96b15633 QCoreApplicationPrivate::sendPostedEvents() #21 0x7fce9820fe74 #22 0x7fce982100e0 QQuickRenderControl::~QQuickRenderControl() #23 0x7fce9f0c6923 #24 0x7fce9f0c4eeb #25 0x7fce9f0c4f69 #26 0x7fce96b436d3 QObject::~QObject() #27 0x7fce97a6023d QWidget::~QWidget() #28 0x7fce9f25130f #29 0x7fce98c7ae52 #30 0x7fce98c7b0a9 #31 0x7fce99453eb2 #32 0x7fce99448d74 #33 0x7fce99291501 #34 0x7fce992c688d #35 0x7fce992c70e9 #36 0x7fce992ce7ad #37 0x7fce99294654 #38 0x7fce9928f3da #39 0x7fce99521a92 #40 0x7fce99521f49 #41 0x7fce98c97938 #42 0x7fce98c97a2a QtWebEngineCore::WebContentsAdapter::~WebContentsAdapter() #43 0x7fce9f2403ee #44 0x7fce9f240409 #45 0x7fce9f23f403 QWebEnginePage::~QWebEnginePage() #46 0x7fce9f23f429 QWebEnginePage::~QWebEnginePage() #47 0x7fce9f24daea #48 0x7fce9ece84b0 WebView::setPage() #49 0x7fce9ecef158 TabbedWebView::setPage() #50 0x7fce9ecf1ecd WebTab::unload() #51 0x7fce9ed08edb TabWidget::qt_static_metacall() #52 0x7fce96b3b227 QMetaObject::activate() #53 0x7fce9ed09801 TabContextMenu::unloadTab() #54 0x7fce96b3b227 QMetaObject::activate() #55 0x7fce97a1fe72 QAction::triggered() #56 0x7fce97a228ad QAction::activate() #57 0x7fce97ba2ad2 #58 0x7fce97ba9977 #59 0x7fce97baa8ab QMenu::mouseReleaseEvent() #60 0x7fce97a65205 QWidget::event() #61 0x7fce97baccb3 QMenu::event() r8: 0000000000000000 r9: 000000000958e720 r10: 00007ffc41ec79e0 r11: 00007fce969aafb0 r12: 000000000ac8fa10 r13: 00007fce96d73b48 r14: 0000000000000005 r15: 00007fce9f061fc0 di: 00007ffc41ec7e50 si: 00000000000000a8 bp: 000000000ac8f9d0 bx: 00007ffc41ec7e50 dx: 0000000000000000 ax: 000000000ac8fbf0 cx: 00007ffc41ec7fb0 sp: 00007ffc41ec7e08 ip: 00007fce96a72700 efl: 0000000000010202 cgf: 0000000000000033 erf: 0000000000000004 trp: 000000000000000e msk: 0000000000000000 cr2: 00000000000000a8 [end of stack trace] Calling _exit(1). Core file will not be generated. ```

it's not so big problem for me, so you can just leave it.

nowrep commented 6 years ago
diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp
index 2f55d1b0..a1c6db91 100644
--- a/src/lib/webengine/webview.cpp
+++ b/src/lib/webengine/webview.cpp
@@ -155,6 +155,7 @@ void WebView::setPage(WebPage *page)
             emit m_page->loadFinished(true);
         }
         m_page->setView(nullptr);
+        m_page->setParent(nullptr);
         m_page->deleteLater();
     }
ghost commented 6 years ago

Oh, why reopened it!!!? Tried the latest patch (over the previous one) in still crash.

nowrep commented 6 years ago

Because closed it by mistake, eh :D

diff --git a/src/lib/webengine/webpage.cpp b/src/lib/webengine/webpage.cpp
index 8d66bf27..607de065 100644
--- a/src/lib/webengine/webpage.cpp
+++ b/src/lib/webengine/webpage.cpp
@@ -119,8 +119,6 @@ WebPage::WebPage(QObject* parent)

 WebPage::~WebPage()
 {
-    mApp->plugins()->emitWebPageDeleted(this);
-
     if (m_runningLoop) {
         m_runningLoop->exit(1);
         m_runningLoop = 0;
diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp
index 2f55d1b0..ff0e354a 100644
--- a/src/lib/webengine/webview.cpp
+++ b/src/lib/webengine/webview.cpp
@@ -92,6 +92,8 @@ WebView::WebView(QWidget* parent)

 WebView::~WebView()
 {
+    mApp->plugins()->emitWebPageDeleted(m_page);
+
     WebInspector::unregisterView(this);
     WebScrollBarManager::instance()->removeWebView(this);
 }
@@ -154,6 +156,7 @@ void WebView::setPage(WebPage *page)
             emit m_page->loadProgress(100);
             emit m_page->loadFinished(true);
         }
+        mApp->plugins()->emitWebPageDeleted(m_page);
         m_page->setView(nullptr);
         m_page->deleteLater();
     }
ghost commented 6 years ago

Should i keep the previous patches? The mistake probably is sign that really should be closed. ;D

nowrep commented 6 years ago

No, only apply this last patch.

ghost commented 6 years ago

That's it, works like a charm! :+1:

ghost commented 6 years ago

I must leave for a while, so i'll be unresponsive in next about an hour.