[gnome-robots] Fix crash on startup
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-robots] Fix crash on startup
- Date: Mon, 4 Aug 2014 21:37:26 +0000 (UTC)
commit 0895adc993ab8063375b90cab7aff8b320492dc2
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Aug 4 07:46:18 2014 -0500
Fix crash on startup
The last three keys were removed in
66a34214ea4a5cab3d9762e084c2968addf93aff so we need to iterate 9 times
instead of 12.
Also, the current code is triggering -Waggressive-loop-optimizations so
let's fix the data type to avoid undefined behavior.
https://bugzilla.gnome.org/show_bug.cgi?id=732401
src/properties.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/properties.c b/src/properties.c
index 9d95206..17be9ea 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -65,7 +65,7 @@
/**********************************************************************/
typedef struct _GnobotsProperties GnobotsProperties;
-#define N_KEYS 12
+#define N_KEYS 9
struct _GnobotsProperties {
gboolean safe_moves;
@@ -74,7 +74,7 @@ struct _GnobotsProperties {
gboolean show_toolbar;
GdkRGBA bgcolour;
gint selected_config;
- guint keys[N_KEYS];
+ gint keys[N_KEYS];
const gchar *themename;
};
/**********************************************************************/
@@ -279,7 +279,7 @@ defkey_cb (GtkWidget * widget, gpointer data)
{
gint i;
- for (i = 0; i < 12; ++i) {
+ for (i = 0; i < N_KEYS; ++i) {
GVariant *variant;
char buffer[64];
@@ -595,7 +595,7 @@ load_keys (void)
gchar buffer[256];
gint i;
- for (i = 0; i < 12; i++) {
+ for (i = 0; i < N_KEYS; i++) {
g_snprintf (buffer, sizeof (buffer), KEY_CONTROL_KEY, i);
properties.keys[i] = g_settings_get_int (settings, buffer);
}
@@ -673,7 +673,7 @@ save_properties (void)
gint i;
gchar *config;
- for (i = 0; i < 12; i++) {
+ for (i = 0; i < N_KEYS; i++) {
conf_set_control_key (i, properties.keys[i]);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]