Workaround for bug 1473471
After three days of debugging I've been able to figure out why it is crashing, why it's random and i can provide a quick workaround in unity8 code.
## Why is it crashing? ##
The problem exists because we use the QML cache and because Qt has this bug https://bugreports.qt.io/browse/QTBUG-47709
The bug in Qt means that if for types with extended properties (Image and "source" in our case coming from the SDK) an Item is created before the type is extended, all subsquent items of the same type won't see the extended property either.
Since we're using the QML cache this means that the code loaded from the cache expects the extended property to be there, so when it access such property, it will crash.
## Why is it random? ##
It's random because the QML file loading is not always done in the *exact* same order, and thus in some cases the first Image is created in a file that imports Ubuntu.Components and in some cases the first image is created in a file that does not.
## How to workaround it? ##
A quick workaround is making sure Ubuntu.Components is imported in the first file that is imported, in unity8's case UnityInputInfo.qml that is a singleton imported from the root file (OrientedShell.qml) Fixes: #1473471
Approved by: Gerry Boland
commitb3a42ef9eaf313ea607b34f43a03dfca4ab8ab81
authorAlbert Astals Cid <albert.astals@canonical.com>
dateWed 12 Aug 2015, 08:40 (11 years ago)
parentb39a7947d68d10
qml/Components/UnityInputInfo/UnityInputInfo.qml+2
@@ -18,6 +18,8 @@ pragma Singleton
1818
1919import QtQuick 2.3
2020import Unity.InputInfo 0.1
21+// Workaround https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1473471
22+import Ubuntu.Components 1.2
2123
2224Item {
2325 id: root
qml/OrientedShell.qml+3
@@ -21,6 +21,9 @@ import GSettings 1.0
2121import "Components"
2222import "Components/UnityInputInfo"
2323import "Rotation"
24+// Backup Workaround https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1473471
25+// in case we remove the UnityInputInfo import
26+import Ubuntu.Components 1.2
2427
2528Rectangle {
2629 id: root