[polypaudio-commits] r794 - in /trunk/src: modules/module-tunnel.c polyp/context.c polyp/def.h polyp/internal.h polyp/introspect.c polyp/operation.c polyp/scache.c polyp/stream.c polyp/stream.h polyp/subscribe.c polypcore/pdispatch.c polypcore/pdispatch.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Apr 24 12:29:16 PDT 2006


Author: lennart
Date: Mon Apr 24 21:29:15 2006
New Revision: 794

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=794&root=polypaudio&view=rev
Log:
* rework reference counting in the client libraries: now refcounting goes
  strictly "one-way" - the "bigger" object refcounts the "smaller" one, never the
  other way round. 

* when registering for a reply packet in pdispatch, specify a function that is
  called when the pdispatch object is destroyed but the reply hasn't yet been
  recieved.

* move prototype of pa_free_cb from stream.h to def.h 


Modified:
    trunk/src/modules/module-tunnel.c
    trunk/src/polyp/context.c
    trunk/src/polyp/def.h
    trunk/src/polyp/internal.h
    trunk/src/polyp/introspect.c
    trunk/src/polyp/operation.c
    trunk/src/polyp/scache.c
    trunk/src/polyp/stream.c
    trunk/src/polyp/stream.h
    trunk/src/polyp/subscribe.c
    trunk/src/polypcore/pdispatch.c
    trunk/src/polypcore/pdispatch.h

Modified: trunk/src/modules/module-tunnel.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-tunnel.c?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/modules/module-tunnel.c (original)
+++ trunk/src/modules/module-tunnel.c Mon Apr 24 21:29:15 2006
@@ -356,7 +356,7 @@
     pa_tagstruct_put_timeval(t, &now);
     
     pa_pstream_send_tagstruct(u->pstream, t);
-    pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_latency_callback, u);
+    pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_latency_callback, u, NULL);
 }
 
 static void stream_get_info_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -449,7 +449,7 @@
 #endif
 
     pa_pstream_send_tagstruct(u->pstream, t);
-    pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_info_callback, u);
+    pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_info_callback, u, NULL);
 }
 
 static void start_subscribe(struct userdata *u) {
@@ -580,7 +580,7 @@
 #endif
     
     pa_pstream_send_tagstruct(u->pstream, reply);
-    pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, create_stream_callback, u);
+    pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, create_stream_callback, u, NULL);
 }
 
 static void pstream_die_callback(pa_pstream *p, void *userdata) {
@@ -647,7 +647,7 @@
     pa_tagstruct_putu32(t, PA_PROTOCOL_VERSION);
     pa_tagstruct_put_arbitrary(t, u->auth_cookie, sizeof(u->auth_cookie));
     pa_pstream_send_tagstruct(u->pstream, t);
-    pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, u);
+    pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, u, NULL);
     
 }
 

Modified: trunk/src/polyp/context.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/context.c?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polyp/context.c (original)
+++ trunk/src/polyp/context.c Mon Apr 24 21:29:15 2006
@@ -162,7 +162,7 @@
 
     while (c->streams)
         pa_stream_set_state(c->streams, PA_STREAM_TERMINATED);
-    
+
     if (c->client)
         pa_socket_client_unref(c->client);
     if (c->pdispatch)
@@ -218,6 +218,10 @@
 
     pa_context_ref(c);
 
+    c->state = st;
+    if (c->state_callback)
+        c->state_callback(c, c->state_userdata);
+
     if (st == PA_CONTEXT_FAILED || st == PA_CONTEXT_TERMINATED) {
         pa_stream *s;
         
@@ -244,10 +248,6 @@
         c->client = NULL;
     }
 
-    c->state = st;
-    if (c->state_callback)
-        c->state_callback(c, c->state_userdata);
-
     pa_context_unref(c);
 }
 
@@ -383,7 +383,7 @@
             reply = pa_tagstruct_command(c, PA_COMMAND_SET_CLIENT_NAME, &tag);
             pa_tagstruct_puts(reply, c->name);
             pa_pstream_send_tagstruct(c->pstream, reply);
-            pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, c);
+            pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, c, NULL);
 
             pa_context_set_state(c, PA_CONTEXT_SETTING_NAME);
             break;
@@ -429,7 +429,7 @@
     pa_tagstruct_putu32(t, PA_PROTOCOL_VERSION);
     pa_tagstruct_put_arbitrary(t, c->conf->cookie, sizeof(c->conf->cookie));
     pa_pstream_send_tagstruct_with_creds(c->pstream, t, 1);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, c);
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, c, NULL);
 
     pa_context_set_state(c, PA_CONTEXT_AUTHORIZING);
 
@@ -817,7 +817,9 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
+
+    if (!o->context)
+        goto finish;
 
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
@@ -853,7 +855,7 @@
 
     t = pa_tagstruct_command(c, PA_COMMAND_EXIT, &tag);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -872,7 +874,7 @@
 
     t = pa_tagstruct_command(c, command, &tag);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, internal_cb, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, internal_cb, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -892,7 +894,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_SET_DEFAULT_SINK, &tag);
     pa_tagstruct_puts(t, name);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT,  pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT,  pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -912,7 +914,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_SET_DEFAULT_SOURCE, &tag);
     pa_tagstruct_puts(t, name);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT,  pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT,  pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -939,7 +941,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_SET_CLIENT_NAME, &tag);
     pa_tagstruct_puts(t, name);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT,  pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT,  pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }

Modified: trunk/src/polyp/def.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/def.h?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polyp/def.h (original)
+++ trunk/src/polyp/def.h Mon Apr 24 21:29:15 2006
@@ -304,6 +304,9 @@
     PA_SOURCE_LATENCY = 2          /**< Supports latency querying */
 } pa_source_flags_t;
 
+/** A generic free() like callback prototype */
+typedef void (*pa_free_cb_t)(void *p);
+
 PA_C_DECL_END
 
 #endif

Modified: trunk/src/polyp/internal.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/internal.h?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polyp/internal.h (original)
+++ trunk/src/polyp/internal.h Mon Apr 24 21:29:15 2006
@@ -159,6 +159,7 @@
     int ref;
     pa_context *context;
     pa_stream *stream;
+    
     PA_LLIST_FIELDS(pa_operation);
 
     pa_operation_state_t state;

Modified: trunk/src/polyp/introspect.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/introspect.c?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polyp/introspect.c (original)
+++ trunk/src/polyp/introspect.c Mon Apr 24 21:29:15 2006
@@ -43,7 +43,9 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
+
+    if (!o->context)
+        goto finish;
 
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
@@ -83,7 +85,9 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
+    
+    if (!o->context)
+        goto finish;
 
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
@@ -127,8 +131,10 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
-
+
+    if (!o->context)
+        goto finish;
+    
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
             goto finish;
@@ -198,7 +204,7 @@
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sink_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sink_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -221,7 +227,7 @@
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sink_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sink_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -235,7 +241,9 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
+
+    if (!o->context)
+        goto finish;
 
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
@@ -306,7 +314,7 @@
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_source_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_source_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -329,9 +337,9 @@
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_source_info_callback, o);
-
-    return pa_operation_ref(o);
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_source_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
+
+    return o;
 }
 
 /*** Client info ***/
@@ -343,7 +351,9 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
+
+    if (!o->context)
+        goto finish;
 
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
@@ -397,7 +407,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_GET_CLIENT_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_client_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_client_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -415,7 +425,9 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
+
+    if (!o->context)
+        goto finish;
     
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
@@ -470,7 +482,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_GET_MODULE_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_module_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_module_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -488,8 +500,10 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
-
+
+    if (!o->context)
+        goto finish;
+    
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
             goto finish;
@@ -551,7 +565,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_GET_SINK_INPUT_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sink_input_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sink_input_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -569,7 +583,9 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
+
+    if (!o->context)
+        goto finish;
 
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
@@ -631,7 +647,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_GET_SOURCE_OUTPUT_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_source_output_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_source_output_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -661,7 +677,7 @@
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_put_cvolume(t, volume);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -687,7 +703,7 @@
     pa_tagstruct_puts(t, name);
     pa_tagstruct_put_cvolume(t, volume);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -709,7 +725,7 @@
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_put_boolean(t, mute);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -733,7 +749,7 @@
     pa_tagstruct_puts(t, name);
     pa_tagstruct_put_boolean(t, mute);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -757,7 +773,7 @@
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_put_cvolume(t, volume);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -781,7 +797,7 @@
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_put_cvolume(t, volume);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -807,7 +823,7 @@
     pa_tagstruct_puts(t, name);
     pa_tagstruct_put_cvolume(t, volume);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -829,7 +845,7 @@
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_put_boolean(t, mute);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -853,7 +869,7 @@
     pa_tagstruct_puts(t, name);
     pa_tagstruct_put_boolean(t, mute);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -867,8 +883,10 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
-
+
+    if (!o->context)
+        goto finish;
+    
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
             goto finish;
@@ -928,7 +946,7 @@
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sample_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sample_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -951,7 +969,7 @@
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sample_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sample_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -976,7 +994,7 @@
     t = pa_tagstruct_command(c, command, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -1000,7 +1018,9 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
+
+    if (!o->context)
+        goto finish;
     
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
@@ -1041,7 +1061,7 @@
     pa_tagstruct_puts(t, name);
     pa_tagstruct_puts(t, argument);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_index_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_index_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -1059,7 +1079,9 @@
     assert(pd);
     assert(o);
     assert(o->ref >= 1);
-    assert(o->context);
+
+    if (!o->context)
+        goto finish;
 
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
@@ -1116,7 +1138,7 @@
     pa_tagstruct_puts(t, name);
     pa_tagstruct_putu32(t, type);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_autoload_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_autoload_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -1138,7 +1160,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_GET_AUTOLOAD_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_autoload_info_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_autoload_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -1168,7 +1190,7 @@
     pa_tagstruct_puts(t, module);
     pa_tagstruct_puts(t, argument);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_index_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_index_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -1191,7 +1213,7 @@
     pa_tagstruct_puts(t, name);
     pa_tagstruct_putu32(t, type);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -1212,7 +1234,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_REMOVE_AUTOLOAD, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
-
-    return o;
-}
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
+
+    return o;
+}

Modified: trunk/src/polyp/operation.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/operation.c?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polyp/operation.c (original)
+++ trunk/src/polyp/operation.c Mon Apr 24 21:29:15 2006
@@ -28,78 +28,89 @@
 #include <polypcore/xmalloc.h>
 
 #include "internal.h"
-
 #include "operation.h"
 
 pa_operation *pa_operation_new(pa_context *c, pa_stream *s, pa_operation_cb_t cb, void *userdata) {
     pa_operation *o;
     assert(c);
 
-    o = pa_xmalloc(sizeof(pa_operation));
+    o = pa_xnew(pa_operation, 1);
     o->ref = 1;
-    o->context = pa_context_ref(c);
-    o->stream = s ? pa_stream_ref(s) : NULL;
+    o->context = c;
+    o->stream = s;
 
     o->state = PA_OPERATION_RUNNING;
     o->callback = cb;
     o->userdata = userdata;
 
-    PA_LLIST_PREPEND(pa_operation, o->context->operations, o);
-    return pa_operation_ref(o);
+    /* Refcounting is strictly one-way: from the "bigger" to the "smaller" object. */
+    PA_LLIST_PREPEND(pa_operation, c->operations, o);
+    pa_operation_ref(o);
+    
+    return o;
 }
 
 pa_operation *pa_operation_ref(pa_operation *o) {
-    assert(o && o->ref >= 1);
+    assert(o);
+    assert(o->ref >= 1);
+    
     o->ref++;
     return o;
 }
 
 void pa_operation_unref(pa_operation *o) {
-    assert(o && o->ref >= 1);
+    assert(o);
+    assert(o->ref >= 1);
 
     if ((--(o->ref)) == 0) {
         assert(!o->context);
         assert(!o->stream);
-        free(o);
+        pa_xfree(o);
     }
 }
 
 static void operation_set_state(pa_operation *o, pa_operation_state_t st) {
-    assert(o && o->ref >= 1);
+    assert(o);
+    assert(o->ref >= 1);
 
     if (st == o->state)
-        return;
-
-    if (!o->context)
         return;
 
     o->state = st;
 
     if ((o->state == PA_OPERATION_DONE) || (o->state == PA_OPERATION_CANCELED)) {
-        PA_LLIST_REMOVE(pa_operation, o->context->operations, o);
-        pa_context_unref(o->context);
-        if (o->stream)
-            pa_stream_unref(o->stream);
+        
+        if (o->context) {
+            assert(o->ref >= 2);
+            
+            PA_LLIST_REMOVE(pa_operation, o->context->operations, o);
+            pa_operation_unref(o);
+        }
+        
         o->context = NULL;
         o->stream = NULL;
         o->callback = NULL;
         o->userdata = NULL;
-
-        pa_operation_unref(o);
     }
 }
 
 void pa_operation_cancel(pa_operation *o) {
-    assert(o && o->ref >= 1);
+    assert(o);
+    assert(o->ref >= 1);
+    
     operation_set_state(o, PA_OPERATION_CANCELED);
 }
 
 void pa_operation_done(pa_operation *o) {
-    assert(o && o->ref >= 1);
+    assert(o);
+    assert(o->ref >= 1);
+    
     operation_set_state(o, PA_OPERATION_DONE);
 }
 
 pa_operation_state_t pa_operation_get_state(pa_operation *o) {
-    assert(o && o->ref >= 1);
+    assert(o);
+    assert(o->ref >= 1);
+
     return o->state;
 }

Modified: trunk/src/polyp/scache.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/scache.c?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polyp/scache.c (original)
+++ trunk/src/polyp/scache.c Mon Apr 24 21:29:15 2006
@@ -53,7 +53,7 @@
     pa_tagstruct_put_channel_map(t, &s->channel_map);
     pa_tagstruct_putu32(t, length);
     pa_pstream_send_tagstruct(s->context->pstream, t);
-    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s);
+    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL);
 
     pa_stream_set_state(s, PA_STREAM_CREATING);
     
@@ -74,7 +74,7 @@
     t = pa_tagstruct_command(s->context, PA_COMMAND_FINISH_UPLOAD_STREAM, &tag);
     pa_tagstruct_putu32(t, s->channel);
     pa_pstream_send_tagstruct(s->context->pstream, t);
-    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_disconnect_callback, s);
+    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_disconnect_callback, s, NULL);
 
     pa_stream_unref(s);
     return 0;
@@ -103,7 +103,7 @@
     pa_tagstruct_putu32(t, volume);
     pa_tagstruct_puts(t, name);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }
@@ -124,7 +124,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_REMOVE_SAMPLE, &tag);
     pa_tagstruct_puts(t, name);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }

Modified: trunk/src/polyp/stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/stream.c?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polyp/stream.c (original)
+++ trunk/src/polyp/stream.c Mon Apr 24 21:29:15 2006
@@ -106,21 +106,15 @@
     s->auto_timing_update_event = NULL;
     s->auto_timing_update_requested = 0;
 
+    /* Refcounting is strictly one-way: from the "bigger" to the "smaller" object. */
     PA_LLIST_PREPEND(pa_stream, c->streams, s);
-
-    /* The context and stream will point at each other. We cannot ref count
-       both though since that will create a loop. */
-    pa_context_ref(s->context);
+    pa_stream_ref(s);
 
     return s;
 }
 
 static void stream_free(pa_stream *s) {
-    assert(s && s->context && !s->channel_valid);
-
-    PA_LLIST_REMOVE(pa_stream, s->context->streams, s);
-
-    pa_context_unref(s->context);
+    assert(s && !s->context && !s->channel_valid);
 
     if (s->auto_timing_update_event) {
         assert(s->mainloop);
@@ -186,19 +180,37 @@
     pa_stream_ref(s);
 
     s->state = st;
-    
+    if (s->state_callback)
+        s->state_callback(s, s->state_userdata);
+
     if ((st == PA_STREAM_FAILED || st == PA_STREAM_TERMINATED) && s->context) {
+
         /* Detach from context */
-        
+        pa_operation *o, *n;
+
+        /* Unref all operatio object that point to us */
+        for (o = s->context->operations; o; o = n) {
+            n = o->next;
+            
+            if (o->stream == s)
+                pa_operation_cancel(o);
+        }
+        
+        /* Drop all outstanding replies for this stream */
+        if (s->context->pdispatch)
+            pa_pdispatch_unregister_reply(s->context->pdispatch, s);
+
         if (s->channel_valid)
             pa_dynarray_put((s->direction == PA_STREAM_PLAYBACK) ? s->context->playback_streams : s->context->record_streams, s->channel, NULL);
+        
+        PA_LLIST_REMOVE(pa_stream, s->context->streams, s);
+        pa_stream_unref(s);
 
         s->channel = 0;
         s->channel_valid = 0;
-    }
-
-    if (s->state_callback)
-        s->state_callback(s, s->state_userdata);
+ 
+        s->context = NULL;
+    }
 
     pa_stream_unref(s);
 }
@@ -513,7 +525,7 @@
         pa_tagstruct_putu32(t, s->buffer_attr.fragsize);
 
     pa_pstream_send_tagstruct(s->context->pstream, t);
-    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s);
+    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL);
 
     pa_stream_set_state(s, PA_STREAM_CREATING);
     
@@ -704,9 +716,9 @@
     t = pa_tagstruct_command(s->context, PA_COMMAND_DRAIN_PLAYBACK_STREAM, &tag);
     pa_tagstruct_putu32(t, s->channel);
     pa_pstream_send_tagstruct(s->context->pstream, t);
-    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, o);
-
-    return pa_operation_ref(o);
+    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
+
+    return o;
 }
 
 static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -717,7 +729,9 @@
     assert(pd);
     assert(o);
     assert(o->stream);
-    assert(o->context);
+
+    if (!o->context)
+        goto finish;
 
     i = &o->stream->timing_info;
 
@@ -869,7 +883,7 @@
         /* Check if we could allocate a correction slot. If not, there are too many outstanding queries */
         PA_CHECK_VALIDITY_RETURN_NULL(s->context, !s->write_index_corrections[cidx].valid, PA_ERR_INTERNAL);
     }
-      o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
+    o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
     
     t = pa_tagstruct_command(
             s->context,
@@ -879,7 +893,7 @@
     pa_tagstruct_put_timeval(t, pa_gettimeofday(&now));
     
     pa_pstream_send_tagstruct(s->context->pstream, t);
-    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_timing_info_callback, o);
+    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_timing_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     if (s->direction == PA_STREAM_PLAYBACK) {
         /* Fill in initial correction data */
@@ -893,7 +907,7 @@
     
 /*     pa_log("requesting update %u\n", tag); */
     
-    return pa_operation_ref(o);
+    return o;
 }
 
 void pa_stream_disconnect_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -941,7 +955,7 @@
             &tag);
     pa_tagstruct_putu32(t, s->channel);
     pa_pstream_send_tagstruct(s->context->pstream, t);
-    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_disconnect_callback, s);
+    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_disconnect_callback, s, NULL);
 
     pa_stream_unref(s);
     return 0;
@@ -993,9 +1007,11 @@
     
     assert(pd);
     assert(o);
-    assert(o->context);
     assert(o->ref >= 1);
 
+    if (!o->context)
+        goto finish;
+    
     if (command != PA_COMMAND_REPLY) {
         if (pa_context_handle_error(o->context, command, t) < 0)
             goto finish;
@@ -1038,12 +1054,12 @@
     pa_tagstruct_putu32(t, s->channel);
     pa_tagstruct_put_boolean(t, !!b);
     pa_pstream_send_tagstruct(s->context->pstream, t);
-    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, o);
+    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     if (s->direction == PA_STREAM_PLAYBACK)
         invalidate_indexes(s, 1, 0);
 
-    return pa_operation_ref(o);
+    return o;
 }
 
 static pa_operation* stream_send_simple_command(pa_stream *s, uint32_t command, pa_stream_success_cb_t cb, void *userdata) {
@@ -1061,9 +1077,9 @@
     t = pa_tagstruct_command(s->context, command, &tag);
     pa_tagstruct_putu32(t, s->channel);
     pa_pstream_send_tagstruct(s->context->pstream, t);
-    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, o);
-
-    return pa_operation_ref(o);
+    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
+
+    return o;
 }
 
 pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *userdata) {
@@ -1136,9 +1152,9 @@
     pa_tagstruct_putu32(t, s->channel);
     pa_tagstruct_puts(t, name);
     pa_pstream_send_tagstruct(s->context->pstream, t);
-    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, o);
-
-    return pa_operation_ref(o);
+    pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
+
+    return o;
 }
 
 int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec) {

Modified: trunk/src/polyp/stream.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/stream.h?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polyp/stream.h (original)
+++ trunk/src/polyp/stream.h Mon Apr 24 21:29:15 2006
@@ -267,9 +267,6 @@
 /** A generic callback for operation completion */
 typedef void (*pa_stream_success_cb_t) (pa_stream*s, int success, void *userdata);
 
-/** A generic free callback */
-typedef void (*pa_free_cb_t)(void *p);
-
 /** A generic request callback */
 typedef void (*pa_stream_request_cb_t)(pa_stream *p, size_t length, void *userdata);
 

Modified: trunk/src/polyp/subscribe.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/subscribe.c?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polyp/subscribe.c (original)
+++ trunk/src/polyp/subscribe.c Mon Apr 24 21:29:15 2006
@@ -75,7 +75,7 @@
     t = pa_tagstruct_command(c, PA_COMMAND_SUBSCRIBE, &tag);
     pa_tagstruct_putu32(t, m);
     pa_pstream_send_tagstruct(c->pstream, t);
-    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o));
+    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
 }

Modified: trunk/src/polypcore/pdispatch.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/pdispatch.c?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polypcore/pdispatch.c (original)
+++ trunk/src/polypcore/pdispatch.c Mon Apr 24 21:29:15 2006
@@ -97,6 +97,7 @@
     PA_LLIST_FIELDS(struct reply_info);
     pa_pdispatch_cb_t callback;
     void *userdata;
+    pa_free_cb_t free_cb;
     uint32_t tag;
     pa_time_event *time_event;
 };
@@ -145,8 +146,12 @@
 static void pdispatch_free(pa_pdispatch *pd) {
     assert(pd);
 
-    while (pd->replies)
+    while (pd->replies) {
+        if (pd->replies->free_cb)
+            pd->replies->free_cb(pd->replies->userdata);
+
         reply_info_free(pd->replies);
+    }
     
     pa_xfree(pd);
 }
@@ -243,7 +248,7 @@
     run_action(r->pdispatch, r, PA_COMMAND_TIMEOUT, NULL);
 }
 
-void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_cb_t cb, void *userdata) {
+void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_cb_t cb, void *userdata, pa_free_cb_t free_cb) {
     struct reply_info *r;
     struct timeval tv;
     assert(pd && pd->ref >= 1 && cb);
@@ -252,6 +257,7 @@
     r->pdispatch = pd;
     r->callback = cb;
     r->userdata = userdata;
+    r->free_cb = free_cb;
     r->tag = tag;
     
     pa_gettimeofday(&tv);

Modified: trunk/src/polypcore/pdispatch.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/pdispatch.h?rev=794&root=polypaudio&r1=793&r2=794&view=diff
==============================================================================
--- trunk/src/polypcore/pdispatch.h (original)
+++ trunk/src/polypcore/pdispatch.h Mon Apr 24 21:29:15 2006
@@ -24,6 +24,7 @@
 
 #include <inttypes.h>
 #include <polyp/mainloop-api.h>
+#include <polyp/def.h>
 #include <polypcore/tagstruct.h>
 #include <polypcore/packet.h>
 
@@ -38,7 +39,7 @@
 
 int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*p, const void*creds, void *userdata);
 
-void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_cb_t callback, void *userdata);
+void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa_pdispatch_cb_t callback, void *userdata, pa_free_cb_t free_cb);
 
 int pa_pdispatch_is_pending(pa_pdispatch *pd);
 




More information about the pulseaudio-commits mailing list