[Icon Item] Don't needlessly unset imagePath
ClosedPublic

Authored by broulik on Aug 28 2017, 2:09 PM.

Details

Summary

We'll eventually delete the Plasma::Svg anyway if we failed to find an appropriate icon.
Just need to make sure we don't use isValid with the old source set but this is only done with m_usesPlasmaTheme, hence the new check there, also optimizes the non-themed case.

Test Plan

Test still passes, I no longer see setImagePath being called with empty string 400 times on startup

Diff Detail

Repository
R242 Plasma Framework (Library)
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Aug 28 2017, 2:09 PM
Restricted Application added projects: Plasma, Frameworks. · View Herald TranscriptAug 28 2017, 2:09 PM
Restricted Application added subscribers: Frameworks, plasma-devel. · View Herald Transcript
davidedmundson added inline comments.
src/declarativeimports/core/iconitem.cpp
199

are you saying we'll always hit this one?

broulik added inline comments.Aug 30 2017, 12:11 PM
src/declarativeimports/core/iconitem.cpp
199

If we use plasma theme and have valid icon (line 176 does set image path and 181 checks for validity if plasmatheme).

If we dont have a plasma theme or failedto load the image in line 176, then we'll try iconloader. if that works, we'll use that. (this line). If that also didn't work we'll dispose of the svgIcon.

I don't see a way where we would end up with the old m_svgIcon still being used.

davidedmundson accepted this revision.Aug 30 2017, 1:13 PM
This revision is now accepted and ready to land.Aug 30 2017, 1:13 PM
This revision was automatically updated to reflect the committed changes.