[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Segmentation fault within some specific conditions
From: Erwan Mathieu <erwan.mathieu () ultimaker ! com>
Date: 2024-03-06 14:17:01
Message-ID: CAK9HiRnwX0XrTY8Xz=rsDHygPxF8Gd4Q3OCKGK0Xds=v4zayoA () mail ! gmail ! com
[Download RAW message or body]
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.
[Attachment #3 (text/html)]
<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>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic