applets/brightness: More robustness for surviving plugin destruction
Follow-up tweaks (c.f. !438 (merged)) 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.
CC @anthonyfieroni, @fusionfuture (thanks for your previous reviews and thanks in advance for this follow-up!)