Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.7.2
-
None
-
Windows 11, Python3.12.5
Windows 11 WSL2/Ubuntu, Python3.12.1
Description
I was trying to use the @Slot(name="...") syntax to keep the function definitions in Python as snake_case but expose them as camelCase to QML, e.g.
... @QmlElement class Bridge(QObject): @Slot(name="doSomething") def do_something(self): print("Something was done") ...
But if I try and invoke that slot from QML, e.g.:
Button { onClicked: () => bridge.doSomething() }
Then the application crashes with a segfault.
Calling slots with no name="..." parameter, or ones where the name agrees with the Python function name, work as expected. Slots with parameters also behave the same way.
If you inspect the bridge object with Javascript from the QML end then it has a property with the camelCase name that appears the same as a working slot (a function with body [native code]).
A minimal reproduction is attached. Clicking the "Call slot" button will print to console as expected, clicking the "Call renamed slot" will crash. I've tested this on both native windows python 3.12.5 and linux via WSL2 python 3.12.1; in both cases the package versions are:
PySide6==6.7.2 PySide6_Addons==6.7.2 PySide6_Essentials==6.7.2 shiboken6==6.7.2
I don't have debug symbols but got a stacktrace from reproducing this under WSL2/linux, if that's helpful. It's almost 8000 lines long consisting mostly of a repeated section so I've snipped that for brevity
Thread 1 "python" received signal SIGSEGV, Segmentation fault. 0x00007ffff76e679d in Shiboken::String::toCString(_object*) () from /<venv-path>/lib/python3.12/site-packages/shiboken6/libshiboken6.abi3.so.6.7 #0 0x00007ffff76e679d in Shiboken::String::toCString(_object*) () from /<venv-path>/lib/python3.12/site-packages/shiboken6/libshiboken6.abi3.so.6.7 #1 0x00007ffff407912d in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6qml.abi3.so.6.7 #2 0x00007ffff6dc8863 in PySide::SignalManager::SignalManagerPrivate::handleMetaCallError(QObject*, int*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6.abi3.so.6.7 #3 0x00007ffff6dcf90d in PySide::SignalManager::SignalManagerPrivate::qtMethodMetacall(QObject*, int, void**) () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6.abi3.so.6.7 #4 0x00007ffff6dd2aff in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6.abi3.so.6.7 #5 0x00007ffff6dd2d1f in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6.abi3.so.6.7 #6 0x0000000000592583 in _PyObject_Call () #7 0x00007ffff6dcf5d1 in PySide::SignalManager::callPythonMetaMethod(QMetaMethod const&, void**, _object*, bool) () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6.abi3.so.6.7 #8 0x00007ffff6dcf8bc in PySide::SignalManager::SignalManagerPrivate::qtMethodMetacall(QObject*, int, void**) () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6.abi3.so.6.7 These 5 frames then appear to repeat a great many times (I haven't verified they're actually always the same, but it does seem to be): #9 0x00007ffff6dd2aff in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6.abi3.so.6.7 #10 0x00007ffff6dd2d1f in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6.abi3.so.6.7 #11 0x0000000000592583 in _PyObject_Call () #12 0x00007ffff6dcf5d1 in PySide::SignalManager::callPythonMetaMethod(QMetaMethod const&, void**, _object*, bool) () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6.abi3.so.6.7 #13 0x00007ffff6dcf8bc in PySide::SignalManager::SignalManagerPrivate::qtMethodMetacall(QObject*, int, void**) () from /<venv-path>/lib/python3.12/site-packages/PySide6/libpyside6.abi3.so.6.7 Until finally we end here: #7489 0x00007ffff3e129bd in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7490 0x00007ffff3ccbe74 in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7491 0x00007ffff3cce339 in QV4::QObjectMethod::callInternal(QV4::Value const*, QV4::Value const*, int) const () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7492 0x00007ffff3d24787 in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7493 0x00007ffff3d281ef in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7494 0x00007ffff3c774ba in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7495 0x00007ffff3c77c77 in QV4::Function::call(QObject*, void**, QMetaType const*, int, QV4::ExecutionContext*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7496 0x00007ffff3dd3558 in QQmlJavaScriptExpression::evaluate(void**, QMetaType const*, int) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7497 0x00007ffff3d78dab in QQmlBoundSignalExpression::evaluate(void**) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7498 0x00007ffff3d79628 in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7499 0x00007ffff3dfd69b in QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Qml.so.6 #7500 0x00007ffff689065e in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Core.so.6 #7501 0x00007fffcafbfad9 in QQuickAbstractButtonPrivate::handleRelease(QPointF const&, unsigned long) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/qml/QtQuick/Controls/../../../lib/libQt6QuickTemplates2.so.6 #7502 0x00007fffcafd4f7b in QQuickControl::mouseReleaseEvent(QMouseEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/qml/QtQuick/Controls/../../../lib/libQt6QuickTemplates2.so.6 #7503 0x00007ffff076ab06 in QQuickItemPrivate::deliverPointerEvent(QEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Quick.so.6 #7504 0x00007ffff07750b8 in QQuickItem::event(QEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Quick.so.6 #7505 0x00007ffff28654f2 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Widgets.so.6 #7506 0x00007ffff683218a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Core.so.6 #7507 0x00007ffff091f97b in QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem(QQuickItem*, bool, QPointerEvent*, bool) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Quick.so.6 #7508 0x00007ffff0920846 in QQuickDeliveryAgentPrivate::deliverUpdatedPoints(QPointerEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Quick.so.6 #7509 0x00007ffff092196b in QQuickDeliveryAgentPrivate::deliverPointerEvent(QPointerEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Quick.so.6 #7510 0x00007ffff0922b80 in QQuickDeliveryAgentPrivate::handleMouseEvent(QMouseEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Quick.so.6 #7511 0x00007ffff0924616 in QQuickDeliveryAgent::event(QEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Quick.so.6 #7512 0x00007ffff0810a77 in QQuickWindow::event(QEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Quick.so.6 #7513 0x00007ffff28654f2 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Widgets.so.6 #7514 0x00007ffff683218a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Core.so.6 #7515 0x00007ffff1eab600 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Gui.so.6 #7516 0x00007ffff1f0577c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Gui.so.6 #7517 0x00007ffff23a33c0 in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Gui.so.6 #7518 0x00007ffff41f0d3b in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #7519 0x00007ffff42462b8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #7520 0x00007ffff41ee3e3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #7521 0x00007ffff6ae976a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Core.so.6 #7522 0x00007ffff683d963 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Core.so.6 #7523 0x00007ffff683a41e in QCoreApplication::exec() () from /<venv-path>/lib/python3.12/site-packages/PySide6/Qt/lib/libQt6Core.so.6 #7524 0x00007ffff3341cbb in ?? () from /<venv-path>/lib/python3.12/site-packages/PySide6/QtWidgets.abi3.so #7525 0x000000000054fde4 in ?? () #7526 0x0000000000572546 in PyObject_Vectorcall () #7527 0x0000000000558903 in _PyEval_EvalFrameDefault () #7528 0x000000000063e959 in PyEval_EvalCode () #7529 0x00000000006630cb in ?? () #7530 0x000000000065e956 in ?? () #7531 0x0000000000674385 in ?? () #7532 0x0000000000673975 in _PyRun_SimpleFileObject () #7533 0x0000000000673647 in _PyRun_AnyFileObject () #7534 0x000000000066daa8 in Py_RunMain () #7535 0x000000000062aa1d in Py_BytesMain () #7536 0x00007ffff7c7ad90 in __libc_start_call_main (main=main@entry=0x62a960, argc=argc@entry=2, argv=argv@entry=0x7fffffffdef8) at ../sysdeps/nptl/libc_start_call_main.h:58 #7537 0x00007ffff7c7ae40 in __libc_start_main_impl (main=0x62a960, argc=2, argv=0x7fffffffdef8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdee8) at ../csu/libc-start.c:392 #7538 0x000000000062a895 in _start ()