-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
cura 2.3.1-2 segfault on startup in libQt5Gui #1393
Comments
See also my comment here: #1072 (comment) In short, this is due to a bug in PyQt which does not yet officially support Qt 5.8. There is currently no real known workaround. |
This crash still happens with PyQt5.8 which is officially released since a few days: https://www.riverbankcomputing.com/software/pyqt/download5 |
Yeah. It seems like pyqt5.8 didn't fix it. I've rebuilt everything and I'm still getting a segfault:
|
I have now reported the crash upstream, waiting to see what the reaction is. |
@awhiemstra thanks. Can you give a link to your bug report? |
There is no bugtracker for PyQt, everything goes through the mailing list. This is ML thread: https://www.riverbankcomputing.com/pipermail/pyqt/2017-February/038875.html |
No wonder I couldn't find one! |
Phil Thompson (PyQt5 dev) fixed the problem: https://www.riverbankcomputing.com/pipermail/pyqt/2017-February/038909.html So I identified, extracted and tested the patch from the snapshot: --- a/qpy/QtQml/qpyqml_register_type.cpp 2017-02-23 03:32:51.000000000 +0100
+++ b/qpy/QtQml/qpyqml_register_type.cpp 2017-02-25 03:32:58.000000000 +0100
@@ -124,13 +124,13 @@
#define QPYQML_TYPE_INIT(n) \
case n##U: \
- QPyQmlObject##n::staticMetaObject = *mo; \
+ QPyQmlObject##n::staticMetaObject = static_mo; \
QPyQmlObject##n::attachedPyType = attached; \
rt->typeId = qRegisterNormalizedMetaType<QPyQmlObject##n *>(ptr_name); \
rt->listId = qRegisterNormalizedMetaType<QQmlListProperty<QPyQmlObject##n> >(list_name); \
rt->objectSize = ctor ? sizeof(QPyQmlObject##n) : 0; \
if (ctor) rt->create = QQmlPrivate::createInto<QPyQmlObject##n>; else rt->create = 0; \
- rt->metaObject = mo; \
+ rt->metaObject = &QPyQmlObject##n::staticMetaObject; \
rt->attachedPropertiesFunction = attached_mo ? QPyQmlObject##n::attachedProperties : 0; \
rt->attachedPropertiesMetaObject = attached_mo; \
rt->parserStatusCast = is_parser_status ? QQmlPrivate::StaticCastSelector<QPyQmlObject##n,QQmlParserStatus>::cast() : -1; \
@@ -219,7 +219,33 @@
return 0;
}
- const QMetaObject *mo = pyqt5_qtqml_get_qmetaobject(py_type);
+ const QMetaObject *orig_mo = pyqt5_qtqml_get_qmetaobject(py_type);
+ QMetaObject static_mo = *orig_mo;
+
+#if QT_VERSION >= 0x050800
+ // Qt v5.8.0 changed the way properties are handled by directly calling a
+ // class's static meta-call (if there was one) directly. This bypasses the
+ // proxy and calls the static meta-call with a pointer to the proxy rather
+ // than a pointer to the real object. To work round this we clone the
+ // QMetaObject chain and remove the references to the static meta-call
+ // forcing the earlier behaviour. This approach may also work with earlier
+ // versions of Qt - but if it ain't broke...
+ static_mo.d.static_metacall = 0;
+
+ QMetaObject *sub_mo = &static_mo;
+
+ // By retaining the QObject static meta-object we don't appear to be a
+ // gadget.
+ for (const QMetaObject *mo = sub_mo->d.superdata; mo != &QObject::staticMetaObject; mo = mo->d.superdata)
+ {
+ QMetaObject *new_mo = new QMetaObject;
+ *new_mo = *mo;
+ new_mo->d.static_metacall = 0;
+
+ sub_mo->d.superdata = new_mo;
+ sub_mo = new_mo;
+ }
+#endif
// See if the type is a parser status.
bool is_parser_status = PyType_IsSubtype(py_type,
@@ -272,7 +298,7 @@
if (qquickitem_register)
{
- sipErrorState estate = qquickitem_register(py_type, mo, ptr_name,
+ sipErrorState estate = qquickitem_register(py_type, orig_mo, ptr_name,
list_name, &rt);
if (estate == sipErrorFail)
The issue is fixed for me in Cura with this. I sent a mail to the Archlinux packager so this patch can be included. Thanks |
Cool! I not so keen on waiting, so I put a pyqt5-hotfix package with that patch into the AUR and made the cura package depend on it. 2.4.0 launches without segfault now. I think this issue can be closed. |
We'll upgrade to PyQt 5.8 when we're ready. Until then, Arch users can compile with 5.8 themselves or use our builds with 5.7. |
Arch Linux, cura built from AUR after complete removal from system including user cache and config. dependencies also rebuilt.
The text was updated successfully, but these errors were encountered: