- 
    
Bug
 - 
    Resolution: Invalid
 - 
    
P1: Critical
 - 
    6.8.3
 - 
    None
 
Behavior of QQmlEngine::clearComponentCache has changed in 6.8.3 in comparison to 6.8.2 and earlier versions, affecting users functionalities relying on that method and it's behavior.
The following code:
import QtQuick import QtQuick.Controls import Test Window { id: root visible: true function load() { const component = Qt.createComponent(`MyItem.qml`) return component.createObject(root) } Component.onCompleted: { let instance = load() console.log(instance) instance.destroy() CacheCleaner.clearComponentCache() instance = load() console.log(instance) } }
On Qt 6.8.2 prints:
qml: MyItem_QMLTYPE_2(0x7ee6a4002df0) qml: MyItem_QMLTYPE_3(0x5706d0db0dd0)
The component has been removed from the cache resulting with other type name for the second instance.
On Qt 6.8.3:
qml: MyItem_QMLTYPE_2(0x71a958002df0) qml: MyItem_QMLTYPE_2(0x5cc39bb09c00)
The type remains the same.
To achieve similar behavior (but not exactly the same) it can be modified to e.g.:
import QtQuick import QtQuick.Controls import Test Window { id: root visible: true function load() { const component = Qt.createComponent(`MyItem.qml`) return component.createObject(root) } Component.onCompleted: { const instance = load() console.log(instance) instance.destroy() CacheCleaner.clearComponentCache() Qt.callLater(() => { CacheCleaner.clearComponentCache() const instance = load() console.log(instance) }) } }
However it's also not clear why two separate calls to QQmlEngine::clearComponentCache are needed to achieve desired effect of cache clearing.
- is duplicated by
 - 
                    
QTBUG-136439 No more possible to use a Loader for QML hot/live reloading since Qt 6.8.3
-         
 - Closed
 
 -         
 
- relates to
 - 
                    
QTBUG-138518 [REG: 6.8.2 → 6.8.3] Inconsistent behavior of QQmlEngine::clearComponentCache
-         
 - Closed
 
 -         
 
- resulted from
 - 
                    
QTBUG-134398 Qt Design Studio does not work with Qt 6.8 because of QML caching
-         
 - Closed
 
 -