Gentoo Archives: gentoo-commits

From: "Samuli Suominen (ssuominen)" <ssuominen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-tv/gtk-v4l/files: gtk-v4l-0.4-device-remove-source-on-finalize.patch
Date: Fri, 11 May 2012 09:28:56
Message-Id: 20120511092845.CD6802004C@flycatcher.gentoo.org
1 ssuominen 12/05/11 09:28:45
2
3 Added: gtk-v4l-0.4-device-remove-source-on-finalize.patch
4 Log:
5 Initial commit.
6
7 (Portage version: 2.2.0_alpha102/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 media-tv/gtk-v4l/files/gtk-v4l-0.4-device-remove-source-on-finalize.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-tv/gtk-v4l/files/gtk-v4l-0.4-device-remove-source-on-finalize.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-tv/gtk-v4l/files/gtk-v4l-0.4-device-remove-source-on-finalize.patch?rev=1.1&content-type=text/plain
14
15 Index: gtk-v4l-0.4-device-remove-source-on-finalize.patch
16 ===================================================================
17 From e7730e2eb0e148e94f6bba13a70ddf61ae94b313 Mon Sep 17 00:00:00 2001
18 From: Hans de Goede <hdegoede@××××××.com>
19 Date: Wed, 9 May 2012 13:00:07 +0200
20 Subject: [PATCH] gtk-v4l-device: remove source on finalize
21
22 This fixes us from getting events from it, with a user_data argument
23 pointing to the finalized object, when the fd gets re-used if another device
24 gets plugged in later, and that device then generates ctrl events.
25
26 Signed-off-by: Hans de Goede <hdegoede@××××××.com>
27 ---
28 lib/gtk-v4l-device.c | 10 +++++++---
29 1 file changed, 7 insertions(+), 3 deletions(-)
30
31 diff --git a/lib/gtk-v4l-device.c b/lib/gtk-v4l-device.c
32 index c4ce1e5..67e8ccc 100644
33 --- a/lib/gtk-v4l-device.c
34 +++ b/lib/gtk-v4l-device.c
35 @@ -43,6 +43,7 @@ enum
36 struct _Gtkv4lDevicePrivate {
37 GList *controls;
38 GIOChannel *channel;
39 + guint channel_source_id;
40 };
41
42 /* will create gtk_v4l_device_get_type and set gtk_v4l_device_parent_class */
43 @@ -166,8 +167,10 @@ gtk_v4l_device_finalize (GObject *object)
44 g_list_foreach (self->priv->controls, gtk_v4l_device_free_control, NULL);
45 g_list_free (self->priv->controls);
46
47 - if (self->priv->channel)
48 + if (self->priv->channel) {
49 + g_source_remove (self->priv->channel_source_id);
50 g_io_channel_unref (self->priv->channel);
51 + }
52
53 if (self->fd != -1)
54 close (self->fd);
55 @@ -303,8 +306,9 @@ gtk_v4l_device_new_control (Gtkv4lDevice *self, struct v4l2_queryctrl *query)
56 r = v4l2_ioctl(self->fd, VIDIOC_SUBSCRIBE_EVENT, &sub);
57 if (r >= 0 && !self->priv->channel) {
58 self->priv->channel = g_io_channel_unix_new (self->fd);
59 - g_io_add_watch (self->priv->channel, G_IO_PRI, gtk_v4l_device_ctrl_event,
60 - self);
61 + self->priv->channel_source_id =
62 + g_io_add_watch (self->priv->channel, G_IO_PRI, gtk_v4l_device_ctrl_event,
63 + self);
64 }
65 }
66
67 --
68 1.7.10