diff options
author | JP Rosevear <jpr@ximian.com> | 2004-07-24 23:30:47 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-07-24 23:30:47 +0800 |
commit | c94fc09a5f0b0c4c99ae2408aea695ae3b07ee91 (patch) | |
tree | ac49acc32e38807d38f3776d8f0407f97c490219 /calendar/gui | |
parent | 379c7e83aaf23c92e969042d66dfd6a96457c21f (diff) | |
download | gsoc2013-evolution-c94fc09a5f0b0c4c99ae2408aea695ae3b07ee91.tar.gz gsoc2013-evolution-c94fc09a5f0b0c4c99ae2408aea695ae3b07ee91.tar.zst gsoc2013-evolution-c94fc09a5f0b0c4c99ae2408aea695ae3b07ee91.zip |
Fixes #61571
2004-07-23 JP Rosevear <jpr@ximian.com>
Fixes #61571
* gui/e-week-view.c (e_week_view_start_editing_event): if the
event moves, find it again using the model data as the invariant
and then find the span again
svn path=/trunk/; revision=26721
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/e-week-view.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index b3a5dbf7c7..8be692efc4 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -2848,7 +2848,8 @@ e_week_view_start_editing_event (EWeekView *week_view, EWeekViewEventSpan *span; ETextEventProcessor *event_processor = NULL; ETextEventProcessorCommand command; - + ECalModelComponent *comp_data; + /* If we are already editing the event, just return. */ if (event_num == week_view->editing_event_num && span_num == week_view->editing_span_num) @@ -2868,11 +2869,28 @@ e_week_view_start_editing_event (EWeekView *week_view, NULL); } - /* FIXME: This implicitly stops any edit of another item, causing it - to be sent to the server and resulting in a call to obj_updated_cb() - which may reload all the events and so our span and text item may - actually be destroyed. So we often get a SEGV. */ + /* Save the comp_data value because we use that as our invariant */ + comp_data = event->comp_data; + e_canvas_item_grab_focus (span->text_item, TRUE); + + /* If the above focus caused things to redraw, then find the + * the event and the span again */ + if (event_num < week_view->events->len) + event = &g_array_index (week_view->events, EWeekViewEvent, event_num); + + if (event_num >= week_view->events->len || event->comp_data != comp_data) { + /* Unfocussing can cause a removal but not a new + * addition so just run backwards through the + * events */ + for (event_num--; event_num >= 0; event_num--){ + event = &g_array_index (week_view->events, EWeekViewEvent, event_num); + if (event->comp_data == comp_data) + break; + } + g_assert (event_num >= 0); + } + span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + span_num); /* Try to move the cursor to the end of the text. */ g_object_get (G_OBJECT (span->text_item), "event_processor", &event_processor, NULL); |