[gnome-color-manager] Do not crash if gcm_libusb_pollfd_remove_all() is called without assigning a device
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Do not crash if gcm_libusb_pollfd_remove_all() is called without assigning a device
- Date: Tue, 27 Jul 2010 10:06:05 +0000 (UTC)
commit 3385cd1c06bcf9d9dc40cd21737efa022d9c5106
Author: Richard Hughes <richard hughsie com>
Date: Tue Jul 27 11:05:38 2010 +0100
Do not crash if gcm_libusb_pollfd_remove_all() is called without assigning a device
libcolor-glib/gcm-common.c | 2 +-
libcolor-glib/gcm-usb.c | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/libcolor-glib/gcm-common.c b/libcolor-glib/gcm-common.c
index c90f15a..163521f 100644
--- a/libcolor-glib/gcm-common.c
+++ b/libcolor-glib/gcm-common.c
@@ -170,7 +170,7 @@ gcm_mat33_set_identity (GcmMat3x3 *src)
void
gcm_mat33_vector_multiply (const GcmMat3x3 *mat_src, const GcmVec3 *vec_src, GcmVec3 *vec_dest)
{
- g_return_if_fail (vec_src != vec_src);
+ g_return_if_fail (vec_src != vec_dest);
vec_dest->v0 = mat_src->m00 * vec_src->v0 +
mat_src->m01 * vec_src->v1 +
mat_src->m02 * vec_src->v2;
diff --git a/libcolor-glib/gcm-usb.c b/libcolor-glib/gcm-usb.c
index c536444..b5a628f 100644
--- a/libcolor-glib/gcm-usb.c
+++ b/libcolor-glib/gcm-usb.c
@@ -146,9 +146,16 @@ gcm_libusb_pollfd_remove_all (GcmUsb *usb)
{
GcmUsbSource *source = usb->priv->source;
GPollFD *pollfd;
- GSList *elem = source->pollfds;
+ GSList *elem;
+
+ /* never connected */
+ if (source == NULL) {
+ egg_debug ("never attached to a context");
+ return;
+ }
/* nothing to see here, move along */
+ elem = source->pollfds;
if (elem == NULL)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]