--0000000000006dbf510612fe9d7e Content-Type: text/plain; charset="UTF-8" Hello, I'm running into a segmentation fault when using PyQt 6.6.0/6.6.1. I could reproduce it with a very basic project, here is how to make it happen: // File test.py from PyQt6.QtCore import QObject from PyQt6.QtGui import QGuiApplication from PyQt6.QtQml import QQmlApplicationEngine, qmlRegisterType class MyModel(QObject): def __init__(self, parent = None): super().__init__(parent = parent) print("I am alive") def __del__(self): print("I am dead ") app = QGuiApplication([]) qmlRegisterType(MyModel, "Test", 1, 0, "MyModel") engine = QQmlApplicationEngine() engine.load("./Main.qml") app.exec() // File Main.qml import QtQuick import QtQuick.Controls import Test 1.0 Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Loader { id: loader; sourceComponent: superComponent; } Button { anchors.centerIn: parent text: "Unload" onClicked: loader.sourceComponent = null } Component { id: superComponent Item { MyModel { property var superProperty: "hello" } } } } 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. For some reason, this happens only when declaring a property on the MyModel instance. If you comment the superProperty declaration, everything is fine. 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). 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. If it is of any help, gdb gives me the following crash point: 0x00007ffff636abb0 in QMetaObject::methodOffset() const () from /..../lib/python3.10/site-packages/PyQt6/Qt6/lib/libQt6Core.so.6 Any idea of why this is happening, and if there is a workaround/fix ? Kind regards, Erwan MATHIEU -- 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. --0000000000006dbf510612fe9d7e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

I'm running into a segmentation fault wh= en using PyQt 6.6.0/6.6.1. I could reproduce = it with a very basic project, here is how to make it happen:

// File= test.py
from PyQt6.QtCore import QObject
from PyQt6.QtGui import QGu= iApplication
from PyQt6.QtQml import QQmlApplicationEngine, qmlRegisterT= ype

class MyModel(QObject):
=C2=A0 =C2=A0 def __init__(self, pare= nt =3D None):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 super().__init__(parent =3D pa= rent)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("I am alive")
=C2= =A0 =C2=A0 def __del__(self):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("I = am dead ")

app =3D QGuiApplication([])
qmlRegisterType(MyMod= el, "Test", 1, 0, "MyModel")
engine =3D QQmlApplicat= ionEngine()
engine.load("./Main.qml")
app.exec()

// = File Main.qml
import QtQuick
import QtQuick.Controls

import Te= st 1.0

Window
{
=C2=A0 =C2=A0 width: 640
=C2=A0 =C2=A0 heig= ht: 480
=C2=A0 =C2=A0 visible: true
=C2=A0 =C2=A0 title: qsTr("H= ello World")

=C2=A0 =C2=A0 Loader { id: loader; sourceComponent= : superComponent; }

=C2=A0 =C2=A0 Button
=C2=A0 =C2=A0 {
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 anchors.centerIn: parent
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 text: "Unload"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 onClicked: l= oader.sourceComponent =3D null
=C2=A0 =C2=A0 }

=C2=A0 =C2=A0 Comp= onent
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 id: superComponent<= br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Item
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MyModel
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 property var superProperty: "hello"
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2= =A0 }
}

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 aft= er that, I get a segmentation fault.

For some reason, this happens o= nly when declaring a property on the MyModel instance. If you comment the s= uperProperty declaration, everything is fine.

We were previously wor= king with version 6.4.2, and this caused no issue. I have it starting from = 6.6.0 (but didn't try intermediate versions).

I also tried to ma= ke this example directly in C++, and I don't get the error, so I think = this is related to PyQt.

If it is of any help, gdb gives me the foll= owing crash point:
0x00007ffff636abb0 in QMetaObject::methodOffset() con= st () from /..../lib/python3.10/site-packages/PyQt6/Qt6/lib/libQt6Core.so.6=

Any idea of why this is happening, and if there is a workaround/fix= ?

Kind regards,

Erwan MATHIEU

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 ab= ove. If you are not the intended recipient, you are directed not to read, d= isclose, distribute or otherwise use this transmission. If you have receive= d this email in error, please notify the sender immediately and delete the = transmission. Delivery of this message is not intended to waive any applica= ble privileges.
--0000000000006dbf510612fe9d7e--