(cherry-pick) applets/brightness: More robustness for surviving plugin destruction
Cherry-pick MR for !440 (merged).
Follow-up tweaks to further improve crash resistance when the brightness applet's plugin is torn down while updating its displays:
- The scope guard, executed at the end of a display update loop, will now also check for aliveness to avoid writing to a member. Thanks to Anthony Fieroni for catching this.
- The aliveness check for queryAndInsertDisplay() will now be
performed after each call in the loop, instead of once at the
outer
while
loop. More safety also for multi-monitor setups.
I'm pretty confident that this puts us at 100% coverage of aliveness checks after co_await.
(cherry picked from commit f501c908)
Co-authored-by: Jakob Petsovits jpetso@petsovits.com