Disconnect and unreference all peak indicator stream objects
Most of sink input peak indicator streams are still connected alive at the time their widgets are destroyed. Disconnect and unreference each one to stop memory leak. When sink input peak indicator stream is recreated, previous stream is only disconnected but not unreferenced. Unreference it to stop memory leak. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/merge_requests/62>
This commit is contained in:
parent
223c6964a8
commit
4bc93d9d9c
|
@ -703,6 +703,7 @@ void MainWindow::createMonitorStreamForSinkInput(SinkInputWidget* w, uint32_t si
|
||||||
|
|
||||||
if (w->peak) {
|
if (w->peak) {
|
||||||
pa_stream_disconnect(w->peak);
|
pa_stream_disconnect(w->peak);
|
||||||
|
pa_stream_unref(w->peak);
|
||||||
w->peak = NULL;
|
w->peak = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,14 @@ MinimalStreamWidget::MinimalStreamWidget(BaseObjectType* cobject) :
|
||||||
volumeMeterVisible(true) {
|
volumeMeterVisible(true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MinimalStreamWidget::~MinimalStreamWidget() {
|
||||||
|
if (peak) {
|
||||||
|
pa_stream_disconnect(peak);
|
||||||
|
pa_stream_unref(peak);
|
||||||
|
peak = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MinimalStreamWidget::init() {
|
void MinimalStreamWidget::init() {
|
||||||
/* Set up the peak meter. This is not done in the constructor, because
|
/* Set up the peak meter. This is not done in the constructor, because
|
||||||
* channelsVBox is initialized by the subclasses, so it's not yet available
|
* channelsVBox is initialized by the subclasses, so it's not yet available
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
class MinimalStreamWidget : public Gtk::VBox {
|
class MinimalStreamWidget : public Gtk::VBox {
|
||||||
public:
|
public:
|
||||||
MinimalStreamWidget(BaseObjectType* cobject);
|
MinimalStreamWidget(BaseObjectType* cobject);
|
||||||
|
virtual ~MinimalStreamWidget();
|
||||||
|
|
||||||
/* Subclass constructors are expected to initialize these variables.
|
/* Subclass constructors are expected to initialize these variables.
|
||||||
* MinimalStreamWidget can't initialize these, because the glade object
|
* MinimalStreamWidget can't initialize these, because the glade object
|
||||||
|
|
Loading…
Reference in New Issue