[cheese/gnome-3-4] Do not add NULL devices to the camera list



commit c832acfb1ba296815cb3d38070faedfb1349ebf4
Author: Hans de Goede <hdegoede redhat com>
Date:   Tue Jun 5 14:54:13 2012 +0200

    Do not add NULL devices to the camera list
    
    cheese_camera_device_monitor_set_up_device() will return NULL for non
    video devices (ie vbi & radio devices). Emitting the added signal with
    such a NULL device, causes it to get added to the camera list, which
    later on causes cheese to crash.
    
    This patch fixes this by not emitting the added signal for non camera
    devices. Fixes bug 677574.
    
    Signed-off-by: Hans de Goede <hdegoede redhat com>

 libcheese/cheese-camera-device-monitor.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/libcheese/cheese-camera-device-monitor.c b/libcheese/cheese-camera-device-monitor.c
index d8b5a10..a299686 100644
--- a/libcheese/cheese-camera-device-monitor.c
+++ b/libcheese/cheese-camera-device-monitor.c
@@ -106,7 +106,8 @@ CheeseCameraDevice* cheese_camera_device_monitor_set_up_device(GUdevDevice *udev
  *
  * Creates a new #CheeseCameraDevice for the supplied @udevice.
  *
- * Returns: a new #CheeseCameraDevice
+ * Returns: a new #CheeseCameraDevice, or %NULL if @udevice was not a V4L
+ * capture device
  */
 CheeseCameraDevice*
 cheese_camera_device_monitor_set_up_device (GUdevDevice *udevice)
@@ -214,7 +215,9 @@ cheese_camera_device_monitor_added (CheeseCameraDeviceMonitor *monitor,
                                     GUdevDevice               *udevice)
 {
   CheeseCameraDevice *device = cheese_camera_device_monitor_set_up_device (udevice);
-  g_signal_emit (monitor, monitor_signals[ADDED], 0, device);
+  /* Ignore non-video devices, GNOME bug #677544. */
+  if (device)
+    g_signal_emit (monitor, monitor_signals[ADDED], 0, device);
 }
 
 /*



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]