(PyQt 6.2.3) Creating a QQmlListProperty will cause access violation on application close (windows)

Jared Jones jared.randall.jones at gmail.com
Thu Mar 3 22:16:46 GMT 2022


No Problem, here is a simple hello world test script:

import sys

from PyQt6.QtWidgets import QApplication, QLabel
from PyQt6.QtQml import QQmlListProperty
from PyQt6.QtCore import QObject
#from pyupdater.client import Client

from config import CLIENT_CONFIG
from config import UpdatePyUpdaterClientConfig

clientConfig=None
UpdatePyUpdaterClientConfig(clientConfig)
app = QApplication(sys.argv)

#this is the troublesome statment:
QQmlListProperty(QObject, QObject(), [])

#label = QLabel("Hello World!")
label = QLabel("<font color=red size=40>Hello World!</font>")

label.show()

app.exec()

On Sat, Feb 26, 2022 at 9:18 AM Phil Thompson <phil at riverbankcomputing.com>
wrote:

> On 11/02/2022 20:44, Jared Jones wrote:
> > Hi everyone,
> >
> > Recently I upgraded an Application in my organization from PyQt 5.5 to
> > PyQt
> > 6.2.3. I noticed that after upgrading my application, it would cause a
> > windows access violation everytime I closed my application. I
> > eventually
> > tracked the issue down to the QQmlListProperty() objects in my program.
> > When the application closes, the underlying QQmlListProperty() objects
> > (at
> > the C++ level) do not seem to be deleted, which causes the access
> > violation. When I removed all QQmlListProperty() objects, my program no
> > longer throws an Access violation. Even when I have no
> > QQmlListProperty()
> > objects in my program, if I drop into pdb, and create a basic
> > QQmlListProperty() object using the syntax "QQmlListProperty(QObject,
> > QObject(), [])", and do not assign this object to any python variable,
> > simply continuing execution after doing this (and then ultimately
> > closing
> > my app). will cause an access violation.
> >
> > As of right now, there is no way around this bug, except for not using
> > QQmlListProperty() entirely. QQmlListProperty() cannot be deleted with
> > sip.delete(), so once the object is created, an access violation WILL
> > happen when your application closes.There doesn't seem to be any way to
> > delete an underlying QQmlListProperty() object
> >
> > Hopefully, this issue can be resolved in a future release.
>
> The next PyQt6 snapshot fixes a bug triggered by...
>
> QQmlListProperty(QObject, QObject(), [])
>
> ...but the bug is also present in PyQt5 so is unlikely to be the
> underlying problem. A simple test script would help.
>
> Phil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20220303/1a00a1ec/attachment.htm>


More information about the PyQt mailing list