aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcontextdata.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make QQmlContext::resolveUrl() constUlf Hermann2020-06-161-13/+16
| | | | | | | It doesn't modify anything. Change-Id: If289873415eb5a0483ca49b34abfac6be9a9e2e5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Prevent premature child destructionFabian Kosmale2020-06-081-2/+2
| | | | | | | | | | | | | | | | | QQmlContextData::emitDestruction suffers from the fact that code can delete objects while emitDestruction is ongoing. Notably, the sequence child->emitDestruction can trigger a call to a->destruction (of one of child's attached components), which then can indirectly delete both child and child->nextChild (for instance, when a StackView gets cleared). We prevent this by using QQmlRefPointer when iterating over the children, which keeps the child alive for the duration of the loop. This solves the same issue as 0c8e51705ac0bb86c4b123ecd30a11b41fd50b24 in 5.15 Fixes: QTBUG-84095 Change-Id: I486a65f791c2a52d6c5c0f188997225b6db75267 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Encapsulate QQmlContextDataUlf Hermann2020-03-231-0/+366
This class is not a private detail of QQmlContext. And it is incredibly hard to see who owns what in there. Let's add some civilization ... We enforce refcounting for QQmlContextData across the code base, with two exceptions: 1. QQmlContextPrivate may or may not own its QQmlContextData. 2. We may request a QQmlContextData owned by its parent QQmlContextData. For these two cases we keep flags in QQmlContextData and when the respective field (m_parent or m_publicContext) is reset, we release() once. Furthermore, QQmlContextData and QQmlGuardedContextData are moved to their own files, in order to de-spaghettify qqmlcontext_p.h and qqmlcontext.cpp. When the QQmlEngine is deleted, any QQmlComponents drop their object creators now, in order to release any context data held by those. Before, the context data would be deleted, but the object creators would retain the dangling pointer. [ChangeLog][QML][Important Behavior Changes] QQmlContext::baseUrl() does what the documentation says now: It prefers explicitly set baseUrls over compilation unit URLs. Only if no baseUrl is set, the CU's URL is returned. It used to prefer the CU's URL. Change-Id: Ieeb5dcb07b45d891526191321386d5443b8f5738 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>