Hi all !

Here is a safe patch to close shout when the Gc clean it.

I think it's safe enough, but I'd like to have some advice before comitting 
anything..


Romain
Index: ocaml-shout/src/shout_stubs.c
===================================================================
--- ocaml-shout/src/shout_stubs.c	(révision 4889)
+++ ocaml-shout/src/shout_stubs.c	(copie de travail)
@@ -45,7 +45,10 @@
 
 static void finalize_shout(value block)
 {
-  shout_free(Shout_val(block));
+  shout_t *x = Shout_val(block);
+  if (shout_get_connected(x) == SHOUTERR_CONNECTED)
+      shout_close(x) ;
+  shout_free(x) ;
 }
 
 static struct custom_operations shout_ops =

Répondre à