[pulseaudio-commits] r1541 - in /branches/lennart/src/pulsecore: sink.c source.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Jul 26 06:17:35 PDT 2007


Author: lennart
Date: Thu Jul 26 15:17:34 2007
New Revision: 1541

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1541&root=3Dpulseaudio&vi=
ew=3Drev
Log:
properly deref sink_input/source_output objects when removing them from a s=
ink/source

Modified:
    branches/lennart/src/pulsecore/sink.c
    branches/lennart/src/pulsecore/source.c

Modified: branches/lennart/src/pulsecore/sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sink.c?rev=3D1541&root=3Dpulseaudio&r1=3D1540&r2=3D1541&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sink.c (original)
+++ branches/lennart/src/pulsecore/sink.c Thu Jul 26 15:17:34 2007
@@ -671,7 +671,8 @@
 =

         case PA_SINK_MESSAGE_REMOVE_INPUT: {
             pa_sink_input *i =3D userdata;
-            pa_hashmap_remove(s->thread_info.inputs, PA_UINT32_TO_PTR(i->i=
ndex));
+            if (pa_hashmap_remove(s->thread_info.inputs, PA_UINT32_TO_PTR(=
i->index)))
+                pa_sink_input_unref(i);
             return 0;
         }
 =


Modified: branches/lennart/src/pulsecore/source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
source.c?rev=3D1541&root=3Dpulseaudio&r1=3D1540&r2=3D1541&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/source.c (original)
+++ branches/lennart/src/pulsecore/source.c Thu Jul 26 15:17:34 2007
@@ -384,20 +384,22 @@
     return pa_idxset_size(s->outputs);
 }
 =

-int pa_source_process_msg(pa_msgobject *o, int code, void *userdata, pa_me=
mchunk *chunk) {
-    pa_source *s =3D PA_SOURCE(o);
+int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, =
pa_memchunk *chunk) {
+    pa_source *s =3D PA_SOURCE(object);
     pa_source_assert_ref(s);
 =

     switch ((pa_source_message_t) code) {
         case PA_SOURCE_MESSAGE_ADD_OUTPUT: {
-            pa_source_output *i =3D userdata;
-            pa_hashmap_put(s->thread_info.outputs, PA_UINT32_TO_PTR(i->ind=
ex), pa_source_output_ref(i));
+            pa_source_output *o =3D userdata;
+            pa_hashmap_put(s->thread_info.outputs, PA_UINT32_TO_PTR(o->ind=
ex), pa_source_output_ref(o));
             return 0;
         }
 =

         case PA_SOURCE_MESSAGE_REMOVE_OUTPUT: {
-            pa_source_output *i =3D userdata;
-            pa_hashmap_remove(s->thread_info.outputs, PA_UINT32_TO_PTR(i->=
index));
+            pa_source_output *o =3D userdata;
+            if (pa_hashmap_remove(s->thread_info.outputs, PA_UINT32_TO_PTR=
(o->index)))
+                pa_source_output_unref(o);
+            =

             return 0;
         }
 =





More information about the pulseaudio-commits mailing list