New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QStyleSheetStyle segfault on exit with exception in request interceptor #8098
Comments
This looks like the same stack trace as the second one here: #5187 My stack trace (click to show)#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=11, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1 0x00007f278348715f in __pthread_kill_internal (signo=11, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 0x00007f2783439472 in __GI_raise (sig=11) at ../sysdeps/posix/raise.c:26
#3 <signal handler called>
#4 0x0000052bff589c40 in ?? ()
#5 0x00007f277de5468e in QStyleSheetStyle::getDefaultStyleSheet() const () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#6 0x00007f277de21e11 in QStyleSheetStyle::styleRules(QObject const*) const () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#7 0x00007f277de29af0 in QStyleSheetStyle::renderRule(QObject const*, int, unsigned long long) const () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#8 0x00007f277de2c9c5 in QStyleSheetStyle::setGeometry(QWidget*) () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#9 0x00007f277de2d28e in QStyleSheetStyle::unpolish(QWidget*) () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#10 0x00007f277ddc9042 in QWidgetPrivate::setStyle_helper(QStyle*, bool) () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#11 0x00007f277ddd81e3 in QWidget::setParent(QWidget*, QFlags<Qt::WindowType>) () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#12 0x00007f277e393b3b in QtWebEngineCore::WebEngineQuickWidget::removeParentBeforeParentDelete() () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineWidgets.so.6
#13 0x00007f27815bc4c3 in void doActivate<false>(QObject*, int, void**) () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#14 0x00007f27815b3c5f in QObject::destroyed(QObject*) () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#15 0x00007f277ddd334b in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#16 0x00007f278126c7d9 in sipQWebEngineView::~sipQWebEngineView() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWebEngineWidgets.abi3.so
#17 0x00007f27815b46f5 in QObjectPrivate::deleteChildren() () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#18 0x00007f277ddd3358 in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#19 0x00007f277e5d3b79 in sipQSplitter::~sipQSplitter() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWidgets.abi3.so
#20 0x00007f27815b46f5 in QObjectPrivate::deleteChildren() () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#21 0x00007f277ddd3358 in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#22 0x00007f277e74f309 in sipQWidget::~sipQWidget() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWidgets.abi3.so
#23 0x00007f27815b46f5 in QObjectPrivate::deleteChildren() () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#24 0x00007f277ddd3358 in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#25 0x00007f277df6b409 in QStackedWidget::~QStackedWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#26 0x00007f27815b46f5 in QObjectPrivate::deleteChildren() () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#27 0x00007f277ddd3358 in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#28 0x00007f277e599a39 in sipQTabWidget::~sipQTabWidget() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWidgets.abi3.so
#29 0x00007f27815b46f5 in QObjectPrivate::deleteChildren() () from /usr/local/Qt-6.7.0/lib/libQt6Core.so.6
#30 0x00007f277ddd3358 in QWidget::~QWidget() () from /usr/local/Qt-6.7.0/lib/libQt6Widgets.so.6
#31 0x00007f277e74f309 in sipQWidget::~sipQWidget() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWidgets.abi3.so
#32 0x00007f2781dfd07f in cleanup_qobject(_sipSimpleWrapper*, void*) () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtCore.abi3.so
#33 0x00007f2782087bb9 in sip_api_visit_wrappers (visitor=0x7f2781dfcfc0 <cleanup_qobject(_sipSimpleWrapper*, void*)>, closure=0x52bfe4d9fe0) at sip_core.c:11861
#34 0x00007f2781dfc9eb in cleanup_on_exit(_object*, _object*) () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtCore.abi3.so
#35 0x000000000051ca94 in cfunction_vectorcall_NOARGS (func=<built-in function _qtcore_cleanup>, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at ../Objects/methodobject.c:486
#36 0x0000000000631058 in atexit_callfuncs (state=0xa5f468 <_PyRuntime+62472>) at ../Modules/atexitmodule.c:98
#37 0x000000000061dba7 in _PyAtExit_Call (interp=<optimized out>) at ../Modules/atexitmodule.c:118
#38 Py_FinalizeEx () at ../Python/pylifecycle.c:1779
#39 0x0000000000646b8c in Py_Exit (sts=2) at ../Python/pylifecycle.c:2940
#40 0x000000000063319f in handle_system_exit () at ../Python/pythonrun.c:771
#41 0x000000000046344e in _PyErr_PrintEx.part.0.lto_priv.0 (tstate=0xa78a18 <_PyRuntime+166328>, set_sys_last_vars=<optimized out>) at ../Python/pythonrun.c:828
#42 0x00007f2781dfd141 in pyqt6_err_print() () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtCore.abi3.so
#43 0x00007f27820918ee in sip_api_call_error_handler (sipGILState=PyGILState_UNLOCKED, py_self=0x7f276eca6950, error_handler=0x7f2781cb5f40 <sipVEH_QtCore_PyQt6(_sipSimpleWrapper*, PyGILState_STATE)>) at sip_core.c:2477
#44 sip_api_call_procedure_method (gil_state=PyGILState_UNLOCKED, error_handler=0x7f2781cb5f40 <sipVEH_QtCore_PyQt6(_sipSimpleWrapper*, PyGILState_STATE)>, py_self=0x7f276eca6950, method=<unknown at remote 0x7f276ed3c480>, fmt=<optimized out>)
at sip_core.c:2047
#45 0x00007f276f8e362d in sipVH_QtWebEngineCore_39(PyGILState_STATE, void (*)(_sipSimpleWrapper*, PyGILState_STATE), _sipSimpleWrapper*, _object*, QWebEngineUrlRequestInfo&) ()
from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWebEngineCore.abi3.so
#46 0x00007f276f8f31d1 in sipQWebEngineUrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo&) () from /mnt/ssd/user/qute-basedirs/venv-6.7.0/lib/python3.11/site-packages/PyQt6/QtWebEngineCore.abi3.so
#47 0x00007f27713c41c6 in QtWebEngineCore::InterceptedRequest::InterceptOnUIThread() () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#48 0x00007f27713d0b14 in QtWebEngineCore::InterceptedRequest::Restart() () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#49 0x00007f27713d19d2 in QtWebEngineCore::ProxyingURLLoaderFactoryQt::CreateLoaderAndStart(mojo::PendingReceiver<network::mojom::URLLoader>, int, unsigned int, network::ResourceRequest const&, mojo::PendingRemote<network::mojom::URLLoaderClient>, net::MutableNetworkTrafficAnnotationTag const&) () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#50 0x00007f2771bd1a34 in network::mojom::URLLoaderFactoryStubDispatch::Accept(network::mojom::URLLoaderFactory*, mojo::Message*) () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#51 0x00007f2775e96993 in mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message*) () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#52 0x00007f2775e979c7 in mojo::MessageDispatcher::Accept(mojo::Message*) () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#53 0x00007f2775e9638e in mojo::InterfaceEndpointClient::HandleIncomingMessage(mojo::Message*) () from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6
#54 0x00007f2775e9acf8 in mojo::internal::MultiplexRouter::ProcessIncomingMessage(mojo::internal::MultiplexRouter::MessageWrapper*, mojo::internal::MultiplexRouter::ClientCallBehavior, base::SequencedTaskRunner*) ()
from /usr/local/Qt-6.7.0/lib/libQt6WebEngineCore.so.6 I don't have debug symbols here but we can see that in The object heirachy from gammaray is: From some shotgun experimentation I think that the QQuickWidget here is inheriting from our MainWindow stylesheet, eg if I remove that line I get no core file left behind. So looks like something in the object heirarchy is invalid at that point, which isn't particularly surprising when we are being called from a chain of destructors! Is this normal? On normal shutdowns we quit in a nice orderly fashion to make sure everything gets shut down in the right order. When we are crashing we just call QApplication.closeAllWindows() and let Qt close everything in whatever order it likes. Ideally it would do that child first but I guess that is up to each widget to implement it's destructor that way. Actually our quitter does call So what can we do to work around this? Some ideas I can come up with:
Anyway, (2) is the only one I got working. Removing the stylsheets from MainWindow in the exception handler seems to prevent a core file from being created. It does mean we are doing more work in a situation where we are crashing, which is not great. But apart from the diff --git i/qutebrowser/misc/crashsignal.py w/qutebrowser/misc/crashsignal.py
index c69dcbe29094..d7c81da58ed7 100644
--- i/qutebrowser/misc/crashsignal.py
+++ w/qutebrowser/misc/crashsignal.py
@@ -273,6 +273,11 @@ class CrashHandler(QObject):
self.is_crashing = True
+ # Remove stylesheets that get inherited by children so they don't try to
+ # access them when everything is shutting down. See #8098
+ for window in objreg.window_registry.values():
+ window.setStyleSheet(None)
+
self._app.closeAllWindows()
if self._args.no_err_windows:
crashdialog.dump_exception_info(exc, info.pages, info.cmd_history, |
Version info:
Does the bug happen if you start with
--temp-basedir
?: yesDescription
After Python exception has been shown:
How to reproduce
Thanks to @Earnestly; also see #5385
The text was updated successfully, but these errors were encountered: