[gcompris] memory activity: fixed several potential crash cases when the memory was run with sound disabled.
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris] memory activity: fixed several potential crash cases when the memory was run with sound disabled.
- Date: Mon, 15 Aug 2011 23:10:13 +0000 (UTC)
commit e98fae1af85799f977353a9b8cd45fcef045f9fb
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Tue Aug 16 01:07:59 2011 +0200
memory activity: fixed several potential crash cases when the memory was run with sound disabled.
src/memory-activity/memory.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/memory-activity/memory.c b/src/memory-activity/memory.c
index 744d36c..d75d3c6 100644
--- a/src/memory-activity/memory.c
+++ b/src/memory-activity/memory.c
@@ -91,10 +91,10 @@ static gchar *numbers;
static gchar *alphabet_lowercase;
static gchar *alphabet_uppercase;
static gchar *operators;
-static gchar *op_add;
-static gchar *op_minus;
-static gchar *op_mult;
-static gchar *op_div;
+static gchar *op_add = NULL;
+static gchar *op_minus = NULL;
+static gchar *op_mult = NULL;
+static gchar *op_div = NULL;
typedef struct {
gchar *data;
@@ -327,7 +327,7 @@ static BoardPlugin menu_bp =
static gboolean to_tux = FALSE;
static gboolean lock_user = FALSE;
-static GQueue *tux_memory;
+static GQueue *tux_memory = NULL;
static gint tux_memory_size;
static gint tux_memory_sizes[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
static gint tux_pairs = 0;
@@ -988,14 +988,19 @@ end_board ()
memory_destroy_all_items();
if (currentMode == MODE_TUX){
- g_queue_free(tux_memory);
+ if (tux_memory)
+ g_queue_free(tux_memory);
tux_memory = NULL;
}
}
g_free(op_add);
+ op_add = NULL;
g_free(op_minus);
+ op_minus = NULL;
g_free(op_mult);
+ op_mult = NULL;
g_free(op_div);
+ op_div = NULL;
gcomprisBoard = NULL;
}
@@ -1142,8 +1147,8 @@ static void memory_destroy_all_items()
g_list_free(winning_pairs);
winning_pairs = NULL;
- while (g_queue_pop_head (tux_memory));
- //tux_memory = NULL;
+ if (tux_memory)
+ while (g_queue_pop_head (tux_memory));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]