From da7c7d850d66ba98f9e31f3f54dd02d738b7a4c1 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 13 May 2004 11:24:34 +0000 Subject: Fixes #57644. 2004-05-13 Not Zed Fixes #57644. * gui/e-day-view.c (row_deleted_check_cb): strdup the uid, as below. (remove_uid_cb): and free it. * gui/e-week-view.c (row_deleted_check_cb): strdup the uid, 'cause otherwise it can go away later as we delete stuff. (remove_uid_cb): free the uid. svn path=/trunk/; revision=25897 --- calendar/ChangeLog | 10 ++++++++++ calendar/gui/e-day-view.c | 5 +++-- calendar/gui/e-week-view.c | 7 ++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 5b47fe211d..4b950c5e4f 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,15 @@ 2004-05-13 Not Zed + Fixes #57644. + + * gui/e-day-view.c (row_deleted_check_cb): strdup the uid, as + below. + (remove_uid_cb): and free it. + + * gui/e-week-view.c (row_deleted_check_cb): strdup the uid, 'cause + otherwise it can go away later as we delete stuff. + (remove_uid_cb): free the uid. + * gui/e-week-view-event-item.c (e_week_view_event_item_draw): add some array bounds checking as an attempt to isolate the crash in #57644. diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index df61ee088f..d2ad842313 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -668,7 +668,7 @@ row_deleted_check_cb (EDayView *day_view, gint day, gint event_num, gpointer dat model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)); if (!e_cal_model_get_component_for_uid (model, uid)) - g_hash_table_insert (uids, (char *)uid, GINT_TO_POINTER (1)); + g_hash_table_insert (uids, g_strdup(uid), GINT_TO_POINTER (1)); return TRUE; } @@ -677,9 +677,10 @@ static void remove_uid_cb (gpointer key, gpointer value, gpointer data) { EDayView *day_view = data; - const char *uid = key; + char *uid = key; e_day_view_foreach_event_with_uid (day_view, uid, e_day_view_remove_event_cb, NULL); + g_free(uid); } static void diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 08589305b3..28d3dff4e9 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -474,7 +474,7 @@ row_deleted_check_cb (EWeekView *week_view, gint event_num, gpointer data) model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)); if (!e_cal_model_get_component_for_uid (model, uid)) - g_hash_table_insert (uids, (char *)uid, GINT_TO_POINTER (1)); + g_hash_table_insert (uids, g_strdup(uid), GINT_TO_POINTER (1)); return TRUE; } @@ -483,9 +483,10 @@ static void remove_uid_cb (gpointer key, gpointer value, gpointer data) { EWeekView *week_view = data; - const char *uid = key; - + char *uid = key; + e_week_view_foreach_event_with_uid (week_view, uid, e_week_view_remove_event_cb, NULL); + g_free(uid); } static void -- cgit