[pulseaudio-discuss] [PATCH pavucontrol] mainwindow: Don't clear the "updating" flag in updateCard() too early.

Colin Guthrie gmane at colin.guthr.ie
Tue Nov 20 13:59:47 PST 2012


'Twas brillig, and Tanu Kaskinen at 19/11/12 13:29 did gyre and gimble:
> The prepareMenu() call can change the active profile selection, which
> in turn will cause a "set card profile" command to be sent to the
> server if the "updating" flag is not set, so the "updating" flag needs
> to be set when calling prepareMenu() from updateCard().
> 
> This caused a problem with disconnecting bluetooth headsets: as part
> of the disconnection procedure, module-bluetooth-device sets the card
> profile to "off". At that point module-card-restore doesn't do
> anything, because the change is marked as "don't save". But the
> profile change event is then sent to pavucontrol, which updates its
> view, and pavucontrol sends the new profile ("off") back to
> pulseaudio, and this time the profile change iss marked as "please
> save", so module-card-restore restores the "off" profile when the
> device is connected again, even though the user never requested the
> "off" profile to be chosen.
> 
> BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=57239
> ---
>  src/mainwindow.cc |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mainwindow.cc b/src/mainwindow.cc
> index 1041eab..720a4db 100644
> --- a/src/mainwindow.cc
> +++ b/src/mainwindow.cc
> @@ -346,12 +346,12 @@ void MainWindow::updateCard(const pa_card_info &info) {
>          }
>      }
>  
> -    w->updating = false;
> -
>      w->prepareMenu();
>  
>      if (is_new)
>          updateDeviceVisibility();
> +
> +    w->updating = false;
>  }
>  
>  bool MainWindow::updateSink(const pa_sink_info &info) {

Looks fine to me and your explanation makes sense.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/



More information about the pulseaudio-discuss mailing list