[Device Notifier] Avoid accessing attributes of stale UDIs
ClosedPublic

Authored by bruns on Sep 22 2018, 10:51 AM.

Details

Summary

When a Solid device is removed (e.g. a CD is ejected) the notifier tries
to read the attributes although the Source for the UDI has just vanished.

Fixes several QML error messages, i.e. "TypeError: Cannot read property
'...' of undefined" and "Unable to assign [undefined] to QString".

Apparently these errors also have the effect of items showing outdated
state, i.e. optical media still being shown after ejecting it.

CCBUG: 394348

Test Plan
  1. insert optical medium
  2. eject

Without the changes, the item was stuck
Now, the item is removed as soon as the medium is ejected

Also, no more errors are logged for the devicenotifier

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.
bruns created this revision.Sep 22 2018, 10:51 AM
Restricted Application added a project: Plasma. · View Herald TranscriptSep 22 2018, 10:51 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
bruns requested review of this revision.Sep 22 2018, 10:51 AM
bruns updated this revision to Diff 42127.Sep 22 2018, 1:13 PM

add one more invalid access fix

Code change looks pretty sane to me.

applets/devicenotifier/package/contents/ui/FullRepresentation.qml
180

Indentation

bruns updated this revision to Diff 42149.Sep 22 2018, 7:09 PM

fix indentation

bruns marked an inline comment as done.Sep 22 2018, 7:11 PM
bruns added inline comments.
applets/devicenotifier/package/contents/ui/FullRepresentation.qml
180

irks, tabs ...

broulik accepted this revision.Sep 24 2018, 11:54 AM
This revision is now accepted and ready to land.Sep 24 2018, 11:54 AM
This revision was automatically updated to reflect the committed changes.
bruns marked an inline comment as done.