Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.7.0
-
None
-
Windows 11 Pro 23H2 / build: 22631.3374
CPU: Intel Core i7-8750H
GPU: Intel UHD Graphics 630
RAM: 16 GB
Qt Version: 6.7.0 msvc2019_64
-
-
7c404391c (dev), 44ccaf1df (6.8), 9a936d174 (dev), b7d9f49ab (6.8), e40e9cbbf (dev)
Description
The documentation to "append"
in: https://doc.qt.io/qt-6/qml-qtqml-models-objectmodel.html
has an example how to use it:
objectModel.append(objectComponent.createObject())
if you follow this, your app will most likely crash sooner or later, because the garbage collector will delete the created object.
Two options:
- the documentation is correct and "append" does some "magic" to have the garbage collector not delete the item. Then the "magic" is broken.
- the documentation is incomplete. In this case, please add a parent to the createObject in the example. There are two other examples for "get" and "insert" where the parent is also missing.
Attachments
For Gerrit Dashboard: QTBUG-124345 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
582094,3 | QQmlObjectModel: Do not store attached objects in global static | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
582154,2 | QQmlObjectModel: Guard against spontaneous deletion of objects | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
582156,1 | Doc: Document the quirks of ObjectModel | dev | qt/qtdeclarative | Status: ABANDONED | -1 | 0 |
582305,6 | QQmlObjectModel: Mark elements when marking the object model | dev | qt/qtdeclarative | Status: MERGED | +2 | +1 |
582552,2 | QQmlObjectModel: Do not store attached objects in global static | 6.8 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
585110,2 | QQmlObjectModel: Guard against spontaneous deletion of objects | 6.8 | qt/qtdeclarative | Status: MERGED | +2 | 0 |