[gnome-network-displays/benzea/fix-p2p-sink-removal: 1/3] meta-provider: Fix internal tracking of sinks




commit e92421c7813269b7d99c864bb4cd011022e2a8a3
Author: Benjamin Berg <bberg redhat com>
Date:   Tue Oct 13 17:30:20 2020 +0200

    meta-provider: Fix internal tracking of sinks
    
    The contained sinks were not tracked correctly. No code was actually
    using it, but we need it now to fix peer removal.

 src/nd-meta-provider.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/nd-meta-provider.c b/src/nd-meta-provider.c
index f229b2d..249753d 100644
--- a/src/nd-meta-provider.c
+++ b/src/nd-meta-provider.c
@@ -101,6 +101,8 @@ provider_sink_added_cb (NdMetaProvider *meta_provider, NdSink *sink, NdProvider
           NdMetaSink *merge_meta;
           NdSink *merge_sink;
           merge_meta = g_ptr_array_remove_index_fast (meta_sinks, 0);
+          if (!g_ptr_array_remove (meta_provider->sinks, merge_meta))
+            g_warning ("Could not remove sink from internal list!");
           g_signal_emit_by_name (meta_provider, "sink-removed", merge_meta);
 
           while ((merge_sink = nd_meta_sink_get_sink (merge_meta)))
@@ -116,6 +118,7 @@ provider_sink_added_cb (NdMetaProvider *meta_provider, NdSink *sink, NdProvider
     {
       meta_sink = nd_meta_sink_new (sink);
       g_signal_emit_by_name (meta_provider, "sink-added", meta_sink);
+      g_ptr_array_add (meta_provider->sinks, meta_sink);
     }
 
   /* Add/Update matches in the deduplication dictionary */


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