Skip to content

(cherry-pick) applets/brightness: Avoid producing duplicate display sliders

Jakob Petsovits requested to merge work/cherry-pick-7e69b584 into Plasma/6.2

Cherry-pick MR for !435 (merged).


Sometimes a display configuration change results in more than one change signal. These can happen in quick succession of each other.

The async code in ScreenBrightnessControl had a problem with this, because it would sometimes interleave parts of its model update function with another call of the same function. This would cause duplicate brightness sliders to appear for the same display.

The solution is to make sure we don't try to update the model while another update is already running.

One approach would be to simply take QCoro and async calls out in favor of synchronous calls which are easier to reason about. However, this would mean we block plasmashell for a longer time.

Instead, this commit introduces a call guard to the update function which prevents another asynchronous call from entering its main body of code while an existing update is already in the works. After the update has finished, we will repeat the update process in case another update request had been issued in the meantime.

BUG: 493844

(cherry picked from commit 7e69b584)

Co-authored-by: Jakob Petsovits jpetso@petsovits.com

Merge request reports

Loading