From 38dc193a9f738c5f5d5d070f7d24a866650a1450 Mon Sep 17 00:00:00 2001 From: Victor Tran Date: Fri, 5 Mar 2021 03:42:39 +1100 Subject: [PATCH] Fix crash when sound device is removed --- plugins/AudioPlugin/quickwidgetsinkinput.cpp | 5 +++-- plugins/AudioPlugin/translations/en_US.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/AudioPlugin/quickwidgetsinkinput.cpp b/plugins/AudioPlugin/quickwidgetsinkinput.cpp index 3058ea2b..5e5557d7 100644 --- a/plugins/AudioPlugin/quickwidgetsinkinput.cpp +++ b/plugins/AudioPlugin/quickwidgetsinkinput.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "common.h" struct QuickWidgetSinkInputPrivate { @@ -129,12 +130,12 @@ void QuickWidgetSinkInput::sinkAdded(PulseAudioQt::Sink* sink) { QAction* action = new QAction(this); action->setCheckable(true); - connect(sink, &PulseAudioQt::Sink::propertiesChanged, this, [ = ] { + connect(sink, &PulseAudioQt::Sink::propertiesChanged, action, [ = ] { action->setText(Common::nameForSink(sink)); }); action->setText(Common::nameForSink(sink)); - connect(d->sinkInput, &PulseAudioQt::SinkInput::deviceIndexChanged, this, [ = ] { + connect(d->sinkInput, &PulseAudioQt::SinkInput::deviceIndexChanged, action, [ = ] { action->setChecked(sink->index() == d->sinkInput->deviceIndex()); }); action->setChecked(sink->index() == d->sinkInput->deviceIndex()); diff --git a/plugins/AudioPlugin/translations/en_US.ts b/plugins/AudioPlugin/translations/en_US.ts index 89b7b8f2..b02d3ff1 100644 --- a/plugins/AudioPlugin/translations/en_US.ts +++ b/plugins/AudioPlugin/translations/en_US.ts @@ -83,7 +83,7 @@ QuickWidgetSinkInput - + Play on