Fix assert when pressing enter really quickly
ClosedPublic

Authored by davidedmundson on Jul 21 2019, 2:26 PM.

Details

Summary

runCurrentIndex checks if "currentItem" is valid.
currentItem relies on the ListView being up-to-date.

The ListView also updates in response to QAIM::modelReset, the same
connection this code is attached to, so run afterwards.

This means the guard for currentItem is potentially out of date, and we
will call SourcesModel::run without a valid index on an empty source
model. This hits an assert.

modelReset and countChanged are identical as update resets
the model (which is wrong but a task for another day)

Test Plan

Could reproduce the crash by typing ":q <enter>" really quickly
Could no longer reproduce

Diff Detail

Repository
R112 Milou
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Jul 21 2019, 2:26 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJul 21 2019, 2:26 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
davidedmundson requested review of this revision.Jul 21 2019, 2:26 PM
broulik accepted this revision.Jul 21 2019, 2:28 PM
This revision is now accepted and ready to land.Jul 21 2019, 2:28 PM
This revision was automatically updated to reflect the committed changes.