Failed to get image from provider Error message seen while using the Icon component

Bug #1349769 reported by Nekhelesh Ramananthan
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu UI Toolkit
Fix Released
Critical
Tim Peeters
ubuntu-ui-toolkit (Ubuntu)
Fix Released
Undecided
Unassigned
Vivid
New
Undecided
Unassigned

Bug Description

I have noticed that while using the icon component in the new clock app that there is always an error message in the console about failing to get image from provider. The error is not critical since despite that message, one can still see the icon.

file:///usr/lib/i386-linux-gnu/qt5/qml/Ubuntu/Components/Icon.qml:85:5: QML Image: Failed to get image from provider: image://theme/add

Here is a sample app to reproduce the issue,

import QtQuick 2.0
import Ubuntu.Components 0.1

MainView {
    objectName: "mainView"
    applicationName: "com.ubuntu.developer.nik90.IconBug"

    width: units.gu(100)
    height: units.gu(75)

    Page {
        title: i18n.tr("Simple")

        Flickable {
            id: mainFlickable

            anchors.fill: parent
            contentHeight: units.gu(50)
            contentWidth: parent.width

            Icon {
                id: plusIcon
                anchors.centerIn: parent
                color: UbuntuColors.coolGrey
                name: "add"
                height: Math.abs(mainFlickable.contentY)
                width: height
            }
        }
    }
}

So basically the add icon size change as you drag the flickable up an down. I notice the error pop up when the icon is barely visible. Try draggging the flickable up very slowly until the icon becomes really small (looks like a dot) and you should see the message pop up on the console, file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/Icon.qml:85:5: QML Image: Failed to get image from provider: image://theme/add

I thought this is happening because the icon size reaches 0 at some point, however on manually setting the icon size to 0, I don't see the error.

Related branches

Tim Peeters (tpeeters)
Changed in ubuntu-ui-toolkit:
importance: Undecided → Critical
assignee: nobody → Tim Peeters (tpeeters)
Revision history for this message
Tim Peeters (tpeeters) wrote :

it happens when the icon size is 1. I added some debugging output and see this:

qml: icon height = 5
qml: icon height = 4
qml: icon height = 3
qml: icon height = 2
qml: icon height = 1
file:///home/tim/dev/ubuntu-ui-toolkit/m/iconFix/modules/Ubuntu/Components/Icon.qml:85:5: QML Image: Failed to get image from provider: image://theme/add
qml: icon height = 0
qml: icon height = 1
qml: icon height = 2
qml: icon height = 1
file:///home/tim/dev/ubuntu-ui-toolkit/m/iconFix/modules/Ubuntu/Components/Icon.qml:85:5: QML Image: Failed to get image from provider: image://theme/add
qml: icon height = 0
qml: icon height = 1
qml: icon height = 2
qml: icon height = 1
file:///home/tim/dev/ubuntu-ui-toolkit/m/iconFix/modules/Ubuntu/Components/Icon.qml:85:5: QML Image: Failed to get image from provider: image://theme/add
qml: icon height = 0
qml: icon height = 1
qml: icon height = 2
qml: icon height = 3
qml: icon height = 4
qml: icon height = 5

the result does not seem to depend the value of GRID_UNIT_PX.

Revision history for this message
Tim Peeters (tpeeters) wrote :

no errors when we don't set the sourceSize in Icon.

Revision history for this message
Tim Peeters (tpeeters) wrote :

it may be that the error occurs when sourceSize.width==0 XOR sourceSize.height==0, which happens because they are not updated at exactly the same time. This also happens when we have a definition like width: visible ? units.gu(2) : 0, and the same for height.

Revision history for this message
Tim Peeters (tpeeters) wrote :

simpler program to reproduce the warning:

import QtQuick 2.0
import Ubuntu.Components 1.1

MainView {
    width: units.gu(40)
    height: units.gu(50)

    Component.onCompleted: icon.visible = true
    Page {
        title: i18n.tr("Simple")

        Image {
            visible: false
            id: icon
            anchors {
                centerIn: parent
            }
            width: visible ? 100 : 0
            height: visible ? 100 : 0
            source: "image://theme/search"
            sourceSize {
                width: icon.width
                height: icon.height
            }
        }
    }
}

Revision history for this message
Tim Peeters (tpeeters) wrote :

I made this bug critical because at least three MRs are pending on a fix (because their tests fail):

https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/noBackButton/+merge/228557
https://code.launchpad.net/~saviq/ubuntu-ui-toolkit/add-icon-source-property/+merge/224122
https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/headIconColor/+merge/227596

The failure in CI for the MRs above is the same as in this bug, but I am not sure the bug is entirely the same. The first fix I tried works for the code above, but not for the MRs. Experimenting more...

Changed in ubuntu-ui-toolkit:
status: New → In Progress
Revision history for this message
Tim Peeters (tpeeters) wrote :

There seem to be two bugs here, one related to the sourceWidth/Height, and the other is a missing build-dep for libqt5svg5 which is needed when running the unit tests.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/staging at revision None, scheduled for release in ubuntu-ui-toolkit, milestone Unknown

Changed in ubuntu-ui-toolkit:
status: In Progress → Fix Committed
Tim Peeters (tpeeters)
Changed in ubuntu-ui-toolkit:
status: Fix Committed → Fix Released
Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.