evolution+pidgin: 5-MOAD scan; 3 defects (evolution-0001 CWE-407, pidgin-0001 CWE-407, pidgin-0002 CWE-312)
This commit is contained in:
parent
a512770591
commit
d9d4b30def
8 changed files with 552 additions and 0 deletions
|
|
@ -0,0 +1,43 @@
|
|||
# UNDF:
|
||||
--- a/src/calendar/gui/e-date-time-list.c
|
||||
+++ b/src/calendar/gui/e-date-time-list.c
|
||||
@@ -56,6 +56,7 @@ struct _EDateTimeListPrivate {
|
||||
GList *list;
|
||||
gboolean use_24_hour_format;
|
||||
gint stamp;
|
||||
+ GHashTable *date_set; /* ISO-date string keys for O(1) dedup */
|
||||
};
|
||||
|
||||
/* EDateTimeList is a GtkTreeModel implementation that stores ICalTime
|
||||
@@ -580,8 +580,21 @@ e_date_time_list_append (EDateTimeList *date_time_list,
|
||||
g_return_if_fail (i_cal_time_is_valid_time ((ICalTime *) itt));
|
||||
|
||||
- if (g_list_find_custom (date_time_list->priv->list, itt, (GCompareFunc) compare_datetime) == NULL) {
|
||||
+ if (date_time_list->priv->date_set == NULL)
|
||||
+ date_time_list->priv->date_set = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
+
|
||||
+ /* Build a canonical key: YYYYMMDD or YYYYMMDDTHHMMSS[Z] */
|
||||
+ gchar *key = i_cal_time_as_ical_string ((ICalTime *) itt);
|
||||
+ if (key == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ if (!g_hash_table_contains (date_time_list->priv->date_set, key)) {
|
||||
+ g_hash_table_add (date_time_list->priv->date_set, key); /* takes ownership */
|
||||
date_time_list->priv->list = g_list_append (date_time_list->priv->list, i_cal_time_clone (itt));
|
||||
row_added (date_time_list, g_list_length (date_time_list->priv->list) - 1);
|
||||
+ } else {
|
||||
+ g_free (key);
|
||||
}
|
||||
|
||||
if (iter) {
|
||||
@@ -598,6 +611,10 @@ e_date_time_list_clear (EDateTimeList *date_time_list)
|
||||
g_return_if_fail (E_IS_DATE_TIME_LIST (date_time_list));
|
||||
|
||||
+ if (date_time_list->priv->date_set) {
|
||||
+ g_hash_table_destroy (date_time_list->priv->date_set);
|
||||
+ date_time_list->priv->date_set = NULL;
|
||||
+ }
|
||||
+
|
||||
g_list_free_full (date_time_list->priv->list, g_object_unref);
|
||||
date_time_list->priv->list = NULL;
|
||||
date_time_list->priv->stamp++;
|
||||
Loading…
Add table
Add a link
Reference in a new issue