https://bugs.kde.org/show_bug.cgi?id=527056

            Bug ID: 527056
           Summary: FIX: a fix for a crash when a link in an article
                    webview is clicked
    Classification: Applications
           Product: akregator
      Version First GIT (master)
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: internal browser
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

The bug is one I've been experiencing  for years on akregator: when i click on
a link inside an open tab(i.e. a webview) it usually crashes akregator.  

Feeding the code and backtrace to claude I was given the following:
" The crash chain is: Chromium calls acceptNavigationRequest() synchronously
from inside its navigation-throttle machinery while a link is clicked → that
emits urlClicked directly (same-thread, direct connection) → slotLinkClicked →
openSafeUrl → signalOpenUrlRequest → FrameManager::openUrl →
WebEngineFrame::openUrl → load() on the same page, before
acceptNavigationRequest() has even returned. That re-enters
WebContentsAdapter::load() and tears down the in-flight
NavigationRequest/InterceptNavigationThrottle while it's still executing —
which is exactly the CHECK() that aborts in your backtrace (frames 0-4).

The fix is to defer the link-click handling so it runs after the
navigation-cancellation unwinds, instead of re-entering load() synchronously
from inside acceptNavigationRequest.
"

Applying the suggested fix (git diff from master):

--- a/src/articleviewer-ng/webengine/articleviewerwebengine.cpp
+++ b/src/articleviewer-ng/webengine/articleviewerwebengine.cpp
@@ -104,7 +104,7 @@
ArticleViewerWebEngine::ArticleViewerWebEngine(KActionCollection *ac, QWidget
*p
     connect(this, &ArticleViewerWebEngine::showContextMenu, this,
&ArticleViewerWebEngine::slotShowContextMenu);

     setFocusPolicy(Qt::WheelFocus);
-    connect(mPageEngine, &ArticleViewerWebEnginePage::urlClicked, this,
&ArticleViewerWebEngine::slotLinkClicked);
+    connect(mPageEngine, &ArticleViewerWebEnginePage::urlClicked, this,
&ArticleViewerWebEngine::slotLinkClicked,  Qt::QueuedConnection);

     mWebEngineViewAccessKey = new WebEngineViewer::WebEngineAccessKey(this,
this);
     mWebEngineViewAccessKey->setActionCollection(mActionCollection);
lines

solves the problem and no longer crashes akregator. 

For info the backtrace is:

#0  0x00007fffed9d6901 in base::ImmediateCrash () at
../../../../../src/3rdparty/chromium/base/immediate_crash.h:180
#1  logging::CheckFailure () at
../../../../../src/3rdparty/chromium/base/check.h:259
#2 
navigation_interception::InterceptNavigationThrottle::~InterceptNavigationThrottle
()
    at
../../../../../src/3rdparty/chromium/components/navigation_interception/intercept_navigation_throttle.cc:39
#3 
navigation_interception::InterceptNavigationThrottle::~InterceptNavigationThrottle
()
    at
../../../../../src/3rdparty/chromium/components/navigation_interception/intercept_navigation_throttle.cc:35
#4  0x00007fffed9d71d1 in
navigation_interception::InterceptNavigationThrottle::~InterceptNavigationThrottle
()
    at
../../../../../src/3rdparty/chromium/components/navigation_interception/intercept_navigation_throttle.cc:40
#5  0x00007fffec10d6be in
std::default_delete<content::NavigationThrottle>::operator() () at
/usr/include/c++/16/bits/unique_ptr.h:92
#6  std::unique_ptr<content::NavigationThrottle,
std::default_delete<content::NavigationThrottle> >::~unique_ptr () at
/usr/include/c++/16/bits/unique_ptr.h:408
#7  std::destroy_at<std::unique_ptr<content::NavigationThrottle,
std::default_delete<content::NavigationThrottle> > > () at
/usr/include/c++/16/bits/stl_construct.h:88
#8  std::_Destroy<std::unique_ptr<content::NavigationThrottle,
std::default_delete<content::NavigationThrottle> > > () at
/usr/include/c++/16/bits/stl_construct.h:164
#9  std::_Destroy<std::unique_ptr<content::NavigationThrottle,
std::default_delete<content::NavigationThrottle> >*> () at
/usr/include/c++/16/bits/stl_construct.h:226
#10 std::_Destroy<std::unique_ptr<content::NavigationThrottle,
std::default_delete<content::NavigationThrottle> >*,
std::unique_ptr<content::NavigationThrottle,
std::default_delete<content::NavigationThrottle> > > () at
/usr/include/c++/16/bits/alloc_traits.h:1085
#11 std::vector<std::unique_ptr<content::NavigationThrottle,
std::default_delete<content::NavigationThrottle> >,
std::allocator<std::unique_ptr<content::NavigationThrottle,
std::default_delete<content::NavigationThrottle> > > >::~vector () at
/usr/include/c++/16/bits/stl_vector.h:792
#12 content::NavigationThrottleRegistryImpl::~NavigationThrottleRegistryImpl ()
    at
../../../../../src/3rdparty/chromium/content/browser/renderer_host/navigation_throttle_registry_impl.cc:66
#13 0x00007fffec10e561 in
content::NavigationThrottleRegistryImpl::~NavigationThrottleRegistryImpl ()
    at
../../../../../src/3rdparty/chromium/content/browser/renderer_host/navigation_throttle_registry_impl.cc:66
#14 0x00007fffec10af03 in
std::default_delete<content::NavigationThrottleRegistryImpl>::operator() () at
/usr/include/c++/16/bits/unique_ptr.h:92
#15 std::unique_ptr<content::NavigationThrottleRegistryImpl,
std::default_delete<content::NavigationThrottleRegistryImpl> >::~unique_ptr ()
    at /usr/include/c++/16/bits/unique_ptr.h:408
#16 content::NavigationRequest::~NavigationRequest () at
../../../../../src/3rdparty/chromium/content/browser/renderer_host/navigation_request.cc:2436
#17 0x00007fffec10c791 in content::NavigationRequest::~NavigationRequest () at
../../../../../src/3rdparty/chromium/content/browser/renderer_host/navigation_request.cc:2436
#18 0x00007fffec01b162 in
content::FrameTreeNode::ResetNavigationRequestButKeepState ()
    at
../../../../../src/3rdparty/chromium/content/browser/renderer_host/frame_tree_node.cc:659
#19 content::FrameTreeNode::TakeNavigationRequest () at
../../../../../src/3rdparty/chromium/content/browser/renderer_host/frame_tree_node.cc:598
#20 0x00007fffec118723 in content::Navigator::Navigate () at
../../../../../src/3rdparty/chromium/content/browser/renderer_host/navigator.cc:961
#21 0x00007fffec0ad1b1 in
content::NavigationControllerImpl::NavigateWithoutEntry ()
    at
../../../../../src/3rdparty/chromium/content/browser/renderer_host/navigation_controller_impl.cc:3944
#22 0x00007fffec0ad5b1 in content::NavigationControllerImpl::LoadURLWithParams
()
    at
../../../../../src/3rdparty/chromium/content/browser/renderer_host/navigation_controller_impl.cc:1461
#23 0x00007fffe87712fb in Navigate () at
/usr/src/debug/qtwebengine-everywhere-src-6.11.2/src/core/web_contents_adapter.cpp:359
#24 0x00007fffe877fa3f in QtWebEngineCore::WebContentsAdapter::load () at
/usr/src/debug/qtwebengine-everywhere-src-6.11.2/src/core/web_contents_adapter.cpp:733
#25 0x00007fffe878079b in QtWebEngineCore::WebContentsAdapter::load () at
/usr/src/debug/qtwebengine-everywhere-src-6.11.2/src/core/web_contents_adapter.cpp:639
#26 0x00007ffff7ee3010 in Akregator::WebEngineFrame::openUrl (this=0x29d1d10,
request=<optimized out>)
    at
/home/con/krypton/kde/src/akregator/src/frame/webengine/webengineframe.cpp:95
#27 0x00007ffff7ee77b0 in Akregator::FrameManager::openUrl (this=0xe993a0,
request=...) at
/home/con/krypton/kde/src/akregator/src/frame/framemanager.cpp:194
#28 0x00007ffff542ccb1 in ??? () at /lib64/libQt6Core.so.6
#29 0x00007ffff7ee5b99 in QMetaObject::activate<void,
Akregator::OpenUrlRequest>
    (sender=<optimized out>, mo=0x7ffff7f7b0c0
<Akregator::Frame::staticMetaObject>, local_signal_index=7, ret=0x0) at
/usr/include/qt6/QtCore/qobjectdefs.h:320
#30 Akregator::Frame::signalOpenUrlRequest (this=<optimized out>,
_t1=<optimized out>)
    at
/home/con/krypton/kde/build/akregator/src/akregatorprivate_autogen/include/moc_frame.cpp:335

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to