1
From ae4f70d52bbc098c2cec5de1d1b979eb0bff87ac Mon Sep 17 00:00:00 2001
2
From: Ali Abdallah <aliov@xfce.org>
3
Date: Sun, 31 Jan 2010 14:38:47 +0000
4
Subject: Check brightness icon array index, to avoid a possible crash when weired brightness level
6
is reported by the backend.
8
This patch was edited for Xubuntu, to remove the unnecessary changes to the INSTALL file.
10
diff --git a/src/xfpm-brightness-widget.c b/src/xfpm-brightness-widget.c
11
index 6f90240..f4c1d19 100644
12
--- a/src/xfpm-brightness-widget.c
13
+++ b/src/xfpm-brightness-widget.c
14
@@ -104,7 +104,7 @@ xfpm_brightness_widget_server_is_notify_osd (void)
16
xfpm_brightness_widget_display_notification (XfpmBrightnessWidget *widget)
19
+ guint brightness_icon_index;
22
static const char *display_icon_name[] =
23
@@ -119,7 +119,10 @@ xfpm_brightness_widget_display_notification (XfpmBrightnessWidget *widget)
25
value = (gfloat) 100 * widget->priv->level / widget->priv->max_level;
27
- i = (gint)value / 25;
28
+ brightness_icon_index = (gint)value / 25;
30
+ g_return_if_fail (brightness_icon_index < 4);
31
+ g_return_if_fail (brightness_icon_index > 0);
33
notify_notification_set_hint_int32 (widget->priv->n,
35
@@ -132,7 +135,7 @@ xfpm_brightness_widget_display_notification (XfpmBrightnessWidget *widget)
36
notify_notification_update (widget->priv->n,
39
- display_icon_name[i]);
40
+ display_icon_name[brightness_icon_index]);
42
notify_notification_show (widget->priv->n, NULL);