Revision: 9578 http://pure-data.svn.sourceforge.net/pure-data/?rev=9578&view=rev Author: eighthave Date: 2008-03-12 14:36:42 -0700 (Wed, 12 Mar 2008)
Log Message: ----------- added free function to free the io_service
Modified Paths: -------------- trunk/externals/apple/ambient_light_sensor-help.pd trunk/externals/apple/ambient_light_sensor.c
Modified: trunk/externals/apple/ambient_light_sensor-help.pd =================================================================== --- trunk/externals/apple/ambient_light_sensor-help.pd 2008-03-12 19:47:14 UTC (rev 9577) +++ trunk/externals/apple/ambient_light_sensor-help.pd 2008-03-12 21:36:42 UTC (rev 9578) @@ -1,4 +1,4 @@ -#N canvas 126 300 567 453 10; +#N canvas 126 300 571 457 10; #X obj 4 398 cnv 15 550 20 empty $0-pddp.cnv.footer empty 20 12 0 14 -228856 -66577 0; #X obj 4 -17 cnv 15 550 40 empty $0-pddp.cnv.header ambient_light_sensor @@ -59,7 +59,7 @@ #X text 216 73 output info on right outlet; #X obj 263 129 route sensor; #X obj 73 73 metro 250; -#X obj 73 54 tgl 15 0 empty empty empty 0 -6 0 10 -262144 -1 -1 0 1 +#X obj 73 54 tgl 15 0 empty empty empty 0 -6 0 10 -204786 -1 -1 1 1 ; #X text 183 46 output sensor values; #X text 102 227 "info" - outputs info about the sensor on the right
Modified: trunk/externals/apple/ambient_light_sensor.c =================================================================== --- trunk/externals/apple/ambient_light_sensor.c 2008-03-12 19:47:14 UTC (rev 9577) +++ trunk/externals/apple/ambient_light_sensor.c 2008-03-12 21:36:42 UTC (rev 9578) @@ -104,6 +104,12 @@ }
+static void ambient_light_sensor_free(t_ambient_light_sensor* x) +{ + IOServiceClose(x->io_connect); +} + + static void *ambient_light_sensor_new(void) { DEBUG(post("ambient_light_sensor_new");); @@ -131,7 +137,6 @@ pd_error(x,"[ambient_light_sensor]: no sensor found"); } kernResult = IOServiceOpen(x->io_service, mach_task_self(), 0, &x->io_connect); - IOObjectRelease(x->io_service); if (kernResult != KERN_SUCCESS) { @@ -148,7 +153,7 @@ { ambient_light_sensor_class = class_new(gensym("ambient_light_sensor"), (t_newmethod)ambient_light_sensor_new, - NULL, + (t_method)ambient_light_sensor_free, sizeof(t_ambient_light_sensor), CLASS_DEFAULT, 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.