<div dir="ltr">Hello,<br><br>I'm running into a segmentation fault when using PyQt 6.6.0/<a href="http://6.6.1.">6.6.1.</a> I could reproduce it with a very basic project, here is how to make it happen:<br><br>// File test.py<br>from PyQt6.QtCore import QObject<br>from PyQt6.QtGui import QGuiApplication<br>from PyQt6.QtQml import QQmlApplicationEngine, qmlRegisterType<br><br>class MyModel(QObject):<br> def __init__(self, parent = None):<br> super().__init__(parent = parent)<br> print("I am alive")<br> def __del__(self):<br> print("I am dead ")<br><br>app = QGuiApplication([])<br>qmlRegisterType(MyModel, "Test", 1, 0, "MyModel")<br>engine = QQmlApplicationEngine()<br>engine.load("./Main.qml")<br>app.exec()<br><br>// File Main.qml<br>import QtQuick<br>import QtQuick.Controls<br><br>import Test 1.0<br><br>Window<br>{<br> width: 640<br> height: 480<br> visible: true<br> title: qsTr("Hello World")<br><br> Loader { id: loader; sourceComponent: superComponent; }<br><br> Button<br> {<br> anchors.centerIn: parent<br> text: "Unload"<br> onClicked: loader.sourceComponent = null<br> }<br><br> Component<br> {<br> id: superComponent<br><br> Item<br> {<br> MyModel<br> {<br> property var superProperty: "hello"<br> }<br> }<br> }<br>}<br><br>Now start the test.py file, and click on the "Unload" button. The Component instance is destroyed, which also destroys the MyModel instance. We can see the print instructions that says so. Just after that, I get a segmentation fault.<br><br>For some reason, this happens only when declaring a property on the MyModel instance. If you comment the superProperty declaration, everything is fine.<br><br>We were previously working with version 6.4.2, and this caused no issue. I have it starting from 6.6.0 (but didn't try intermediate versions).<br><br>I also tried to make this example directly in C++, and I don't get the error, so I think this is related to PyQt.<br><br>If it is of any help, gdb gives me the following crash point:<br>0x00007ffff636abb0 in QMetaObject::methodOffset() const () from /..../lib/python3.10/site-packages/PyQt6/Qt6/lib/libQt6Core.so.6<br><br>Any idea of why this is happening, and if there is a workaround/fix ?<br><br>Kind regards,<br><br>Erwan MATHIEU</div>
<br>
NOTICE: This email may contain information that is confidential or attorney-client privileged and may constitute inside information or trade secrets. The contents of this email are intended only for the recipient(s) listed above. If you are not the intended recipient, you are directed not to read, disclose, distribute or otherwise use this transmission. If you have received this email in error, please notify the sender immediately and delete the transmission. Delivery of this message is not intended to waive any applicable privileges.<br>