[gnome-media] Don't create a new monitor every time we switch inputs



commit f6f43d0e1eb800455c24a75ce418d21a54bb5dbd
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Aug 13 10:49:34 2009 +0100

    Don't create a new monitor every time we switch inputs
    
    Otherwise we're leaking them like we're in an incontinence advert.

 gnome-volume-control/src/gvc-mixer-dialog.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gnome-volume-control/src/gvc-mixer-dialog.c b/gnome-volume-control/src/gvc-mixer-dialog.c
index 3906e84..eb3ac28 100644
--- a/gnome-volume-control/src/gvc-mixer-dialog.c
+++ b/gnome-volume-control/src/gvc-mixer-dialog.c
@@ -436,10 +436,15 @@ create_monitor_stream_for_source (GvcMixerDialog *dialog,
         pa_context    *context;
         int            res;
         pa_proplist   *proplist;
+        gboolean       has_monitor;
 
         if (stream == NULL) {
                 return;
         }
+        has_monitor = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (stream), "has-monitor"));
+        if (has_monitor != FALSE) {
+                return;
+        }
 
         g_debug ("Create monitor for %u",
                  gvc_mixer_stream_get_index (stream));
@@ -481,6 +486,8 @@ create_monitor_stream_for_source (GvcMixerDialog *dialog,
         if (res < 0) {
                 g_warning ("Failed to connect monitoring stream");
                 pa_stream_unref (s);
+        } else {
+                g_object_set_data (G_OBJECT (stream), "has-monitor", GINT_TO_POINTER (TRUE));
         }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]