[pulseaudio-commits] [Git][pulseaudio/pavucontrol][master] Disconnect and unreference all peak indicator stream objects

PulseAudio Marge Bot (@pulseaudio-merge-bot) gitlab at gitlab.freedesktop.org
Sun Aug 15 14:49:28 UTC 2021



PulseAudio Marge Bot pushed to branch master at PulseAudio / pavucontrol


Commits:
4bc93d9d by Igor V. Kovalenko at 2021-08-15T12:26:23+03:00
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>

- - - - -


3 changed files:

- src/mainwindow.cc
- src/minimalstreamwidget.cc
- src/minimalstreamwidget.h


Changes:

=====================================
src/mainwindow.cc
=====================================
@@ -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;
     }
 


=====================================
src/minimalstreamwidget.cc
=====================================
@@ -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


=====================================
src/minimalstreamwidget.h
=====================================
@@ -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



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/commit/4bc93d9d9c1d7f5d195076b514c6ac2391a7017f

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/commit/4bc93d9d9c1d7f5d195076b514c6ac2391a7017f
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20210815/b955cfce/attachment-0001.htm>


More information about the pulseaudio-commits mailing list