aboutsummaryrefslogtreecommitdiff
path: root/ambient_light_sensor.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-03-12 21:36:42 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-03-12 21:36:42 +0000
commit2d2a8ce82bc9181a07b2647faae3a415fa741d0d (patch)
treea9f92a8ceee91b221347e41d632a41f039dfba55 /ambient_light_sensor.c
parent4922e9700e9e80b251913e3d1a493f378660e8fd (diff)
added free function to free the io_service
svn path=/trunk/externals/apple/; revision=9578
Diffstat (limited to 'ambient_light_sensor.c')
-rw-r--r--ambient_light_sensor.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ambient_light_sensor.c b/ambient_light_sensor.c
index 9e3f93c..139f359 100644
--- a/ambient_light_sensor.c
+++ b/ambient_light_sensor.c
@@ -104,6 +104,12 @@ static void ambient_light_sensor_info(t_ambient_light_sensor* x)
}
+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 @@ static void *ambient_light_sensor_new(void)
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 @@ void ambient_light_sensor_setup(void)
{
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);