[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test2-38-g5e24b6d

Lennart Poettering gitmailer-noreply at 0pointer.de
Fri Jul 24 06:49:04 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  2bbdf631f8ef1029558be19bcf8a9176a5932b8b (commit)

- Log -----------------------------------------------------------------
5e24b6d memblock: try to hit an assert earlier when ref counting doesn't work
-----------------------------------------------------------------------

Summary of changes:
 src/pulsecore/memblock.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

-----------------------------------------------------------------------

commit 5e24b6dff532ef82e028a78f020a826032493b2e
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 24 15:49:22 2009 +0200

    memblock: try to hit an assert earlier when ref counting doesn't work

diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index 2c3f98a..3bc10de 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -96,6 +96,7 @@ struct pa_memimport_segment {
     unsigned n_blocks;
 };
 
+/* A collection of multiple segments */
 struct pa_memimport {
     pa_mutex *mutex;
 
@@ -514,9 +515,9 @@ static void memblock_free(pa_memblock *b) {
 
             pa_mutex_lock(import->mutex);
 
-            pa_hashmap_remove(
-                    import->blocks,
-                    PA_UINT32_TO_PTR(b->per_type.imported.id));
+            pa_assert_se(pa_hashmap_remove(
+                                 import->blocks,
+                                 PA_UINT32_TO_PTR(b->per_type.imported.id)));
 
             pa_assert(segment->n_blocks >= 1);
             if (-- segment->n_blocks <= 0)
@@ -677,9 +678,9 @@ static void memblock_replace_import(pa_memblock *b) {
 
     pa_mutex_lock(import->mutex);
 
-    pa_hashmap_remove(
-            import->blocks,
-            PA_UINT32_TO_PTR(b->per_type.imported.id));
+    pa_assert_se(pa_hashmap_remove(
+                         import->blocks,
+                         PA_UINT32_TO_PTR(b->per_type.imported.id)));
 
     memblock_make_local(b);
 
@@ -960,6 +961,11 @@ pa_memblock* pa_memimport_get(pa_memimport *i, uint32_t block_id, uint32_t shm_i
 
     pa_mutex_lock(i->mutex);
 
+    if ((b = pa_hashmap_get(i->blocks, PA_UINT32_TO_PTR(block_id)))) {
+        pa_memblock_ref(b);
+        goto finish;
+    }
+
     if (pa_hashmap_size(i->blocks) >= PA_MEMIMPORT_SLOTS_MAX)
         goto finish;
 
@@ -989,12 +995,11 @@ pa_memblock* pa_memimport_get(pa_memimport *i, uint32_t block_id, uint32_t shm_i
 
     seg->n_blocks++;
 
+    stat_add(b);
+
 finish:
     pa_mutex_unlock(i->mutex);
 
-    if (b)
-    stat_add(b);
-
     return b;
 }
 

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list