Skip to content
Snippets Groups Projects
Commit 4bc93d9d authored by Igor Kovalenko's avatar Igor Kovalenko
Browse files

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: <!62>
parent 223c6964
1 merge request!62Disconnect and unreference all peak indicator stream objects
......@@ -703,6 +703,7 @@ void MainWindow::createMonitorStreamForSinkInput(SinkInputWidget* w, uint32_t si
if (w->peak) {
pa_stream_disconnect(w->peak);
pa_stream_unref(w->peak);
w->peak = NULL;
}
......
......@@ -39,6 +39,14 @@ MinimalStreamWidget::MinimalStreamWidget(BaseObjectType* cobject) :
volumeMeterVisible(true) {
}
MinimalStreamWidget::~MinimalStreamWidget() {
if (peak) {
pa_stream_disconnect(peak);
pa_stream_unref(peak);
peak = NULL;
}
}
void MinimalStreamWidget::init() {
/* 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
......
......@@ -26,6 +26,7 @@
class MinimalStreamWidget : public Gtk::VBox {
public:
MinimalStreamWidget(BaseObjectType* cobject);
virtual ~MinimalStreamWidget();
/* Subclass constructors are expected to initialize these variables.
* MinimalStreamWidget can't initialize these, because the glade object
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment