Fix crash when sound device is removed

This commit is contained in:
Victor Tran 2021-03-05 03:42:39 +11:00
parent 3f1791afdc
commit 38dc193a9f
No known key found for this signature in database
GPG key ID: 1F0729FE016CDC3E
2 changed files with 4 additions and 3 deletions

View file

@ -23,6 +23,7 @@
#include <Context>
#include <the-libs_global.h>
#include <QMenu>
#include <QPointer>
#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());

View file

@ -83,7 +83,7 @@
<context>
<name>QuickWidgetSinkInput</name>
<message>
<location filename="../quickwidgetsinkinput.cpp" line="62"/>
<location filename="../quickwidgetsinkinput.cpp" line="63"/>
<source>Play on</source>
<translation type="unfinished"></translation>
</message>