Microoptimise: don't change fillMode of image just before deleting it It is still set for when a source is applied for the next transistion.
ClosedPublic

Authored by davidedmundson on Aug 11 2017, 11:26 AM.

Details

Summary

This saves evaluating a new paintedSize and doing a bunch of evaluations
for no reason.

More importantly it works round a Qt animation crash.

CCBUG: 381105

Test Plan

Cloned this code whilst making a tiny reproducible test case
Found swapping these lines made that go away
Given it results in less processing we may as well do it.

End user result is the same.

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Restricted Application added a project: Plasma. · View Herald TranscriptAug 11 2017, 11:26 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript

To expand on the crash:

Killer line is

fadeAnim.running = Qt.binding(function() {

    return currentImage.status !== Image.Loading && otherImage.status !== Image.Loading
})

the idea being to delay the loading until both things are loaded.

But scriptAnimation at the end does:

otherImage.fillMode = fillMode;
otherImage.source = "";

which means from inside the animation we change fillMode - running goes to false as it reloads the image with the new fillMode (asynchronously)
then we unset the source, running goes to true as it's no longer loading

We're completely restarting the animation from within the animation.
Qt doesn't like that.

broulik accepted this revision.Aug 11 2017, 12:07 PM
This revision is now accepted and ready to land.Aug 11 2017, 12:07 PM
mart accepted this revision.Aug 11 2017, 12:29 PM
This revision was automatically updated to reflect the committed changes.