diff options
author | Damon Chaplin <damon@ximian.com> | 2001-10-30 09:37:52 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2001-10-30 09:37:52 +0800 |
commit | cf4dbf9ee3790b9cf5e146594fa851757cd89881 (patch) | |
tree | a7b5fc1a3a17c61e7f3e49e3cdf218c5cb8f9819 | |
parent | 46dee516710185ab5fb881a02580c66f3e82181c (diff) | |
download | gsoc2013-evolution-cf4dbf9ee3790b9cf5e146594fa851757cd89881.tar.gz gsoc2013-evolution-cf4dbf9ee3790b9cf5e146594fa851757cd89881.tar.zst gsoc2013-evolution-cf4dbf9ee3790b9cf5e146594fa851757cd89881.zip |
ref the ECalendarItem and check if it gets destroyed, to try to avoid a
2001-10-29 Damon Chaplin <damon@ximian.com>
* e-calendar-item.c (e_calendar_item_signal_emission_idle_cb): ref
the ECalendarItem and check if it gets destroyed, to try to avoid a
free memory write.
* e-dateedit.c (e_date_edit_set_time_of_day): allow setting the time
to empty by passing hour as -1.
svn path=/trunk/; revision=14394
-rw-r--r-- | widgets/misc/ChangeLog | 9 | ||||
-rw-r--r-- | widgets/misc/e-calendar-item.c | 14 | ||||
-rw-r--r-- | widgets/misc/e-dateedit.c | 14 | ||||
-rw-r--r-- | widgets/misc/e-dateedit.h | 1 |
4 files changed, 31 insertions, 7 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 10bfd942eb..720b7edec5 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,12 @@ +2001-10-29 Damon Chaplin <damon@ximian.com> + + * e-calendar-item.c (e_calendar_item_signal_emission_idle_cb): ref + the ECalendarItem and check if it gets destroyed, to try to avoid a + free memory write. + + * e-dateedit.c (e_date_edit_set_time_of_day): allow setting the time + to empty by passing hour as -1. + 2001-10-23 Jeffrey Stedfast <fejj@ximian.com> * e-filter-bar.c (rule_editor_clicked): Don't add the menu item diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index 48febd1f23..9c52e2d9bf 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -2889,18 +2889,26 @@ e_calendar_item_signal_emission_idle_cb (gpointer data) calitem->signal_emission_idle_id = 0; + /* We ref the calitem & check in case it gets destroyed, since we + were getting a free memory write here. */ + gtk_object_ref (calitem); + if (calitem->date_range_changed) { + calitem->date_range_changed = FALSE; gtk_signal_emit (GTK_OBJECT (calitem), e_calendar_item_signals[DATE_RANGE_CHANGED]); - calitem->date_range_changed = FALSE; } - if (calitem->selection_changed) { + if (GTK_OBJECT_DESTROYED (calitem)) { + g_warning ("e_calendar_item_signal_emission_idle_cb: item destroyed"); + } else if (calitem->selection_changed) { + calitem->selection_changed = FALSE; gtk_signal_emit (GTK_OBJECT (calitem), e_calendar_item_signals[SELECTION_CHANGED]); - calitem->selection_changed = FALSE; } + gtk_object_unref (calitem); + GDK_THREADS_LEAVE (); return FALSE; } diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index c0456c6437..fc3ac67407 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -758,7 +758,7 @@ e_date_edit_get_time_of_day (EDateEdit *dedit, /** * e_date_edit_set_time_of_day: * @dedit: an #EDateEdit widget. - * @hour: the hour to set. + * @hour: the hour to set, or -1 to set the time to None (i.e. empty). * @minute: the minute to set. * * Description: Sets the time in the time field. @@ -775,9 +775,15 @@ e_date_edit_set_time_of_day (EDateEdit *dedit, priv = dedit->priv; - if (priv->time_set_to_none - || priv->hour != hour - || priv->minute != minute) { + if (hour == -1) { + gboolean allow_no_date_set = e_date_edit_get_allow_no_date_set (dedit); + g_return_if_fail (allow_no_date_set); + if (!priv->time_set_to_none) { + priv->time_set_to_none = TRUE; + } + } else if (priv->time_set_to_none + || priv->hour != hour + || priv->minute != minute) { priv->time_set_to_none = FALSE; priv->hour = hour; priv->minute = minute; diff --git a/widgets/misc/e-dateedit.h b/widgets/misc/e-dateedit.h index 68529fa563..49ea443235 100644 --- a/widgets/misc/e-dateedit.h +++ b/widgets/misc/e-dateedit.h @@ -114,6 +114,7 @@ void e_date_edit_set_date (EDateEdit *dedit, gboolean e_date_edit_get_time_of_day (EDateEdit *dedit, gint *hour, gint *minute); +/* Set the time. Pass -1 as hour to set to empty. */ void e_date_edit_set_time_of_day (EDateEdit *dedit, gint hour, gint minute); |