diff options
author | Radek Doulik <rodo@ximian.com> | 2002-02-15 04:18:05 +0800 |
---|---|---|
committer | Radek Doulik <rodo@src.gnome.org> | 2002-02-15 04:18:05 +0800 |
commit | 24b63477d15ebd6bdc2cd47d3f63fb58c50b07cf (patch) | |
tree | 2cb98460b4a53edf2a16fb4e507fda19bd41edd7 | |
parent | 600a0062ec537cb74dd196b47544146083c5b3f9 (diff) | |
download | gsoc2013-evolution-24b63477d15ebd6bdc2cd47d3f63fb58c50b07cf.tar.gz gsoc2013-evolution-24b63477d15ebd6bdc2cd47d3f63fb58c50b07cf.tar.zst gsoc2013-evolution-24b63477d15ebd6bdc2cd47d3f63fb58c50b07cf.zip |
fix case when priority is undefined and pri_a or pri_b is returned as
2002-02-14 Radek Doulik <rodo@ximian.com>
* e-summary-tasks.c (sort_uids): fix case when priority is
undefined and pri_a or pri_b is returned as NULL, also fixes
memory leak
svn path=/trunk/; revision=15727
-rw-r--r-- | my-evolution/ChangeLog | 6 | ||||
-rw-r--r-- | my-evolution/e-summary-tasks.c | 20 |
2 files changed, 21 insertions, 5 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index 64a5c04b1a..4ebee50060 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,9 @@ +2002-02-14 Radek Doulik <rodo@ximian.com> + + * e-summary-tasks.c (sort_uids): fix case when priority is + undefined and pri_a or pri_b is returned as NULL, also fixes + memory leak + 2002-02-08 Damon Chaplin <damon@ximian.com> * e-summary-calendar.c (e_cal_comp_util_compare_event_timezones): diff --git a/my-evolution/e-summary-tasks.c b/my-evolution/e-summary-tasks.c index 6bcc65d2b7..51ab45c051 100644 --- a/my-evolution/e-summary-tasks.c +++ b/my-evolution/e-summary-tasks.c @@ -136,7 +136,8 @@ sort_uids (gconstpointer a, CalComponent *comp_a, *comp_b; CalClient *client = user_data; CalClientGetStatus status; - int real_a = 0, real_b = 0; + /* let undefined priorities be lowest ones */ + int lowest = 10, rv; int *pri_a, *pri_b; /* a after b then return > 0 */ @@ -149,13 +150,22 @@ sort_uids (gconstpointer a, if (status != CAL_CLIENT_GET_SUCCESS) return 1; - pri_a = &real_a; - pri_b = &real_b; - cal_component_get_priority (comp_a, &pri_a); cal_component_get_priority (comp_b, &pri_b); - return *pri_a - *pri_b; + if (pri_a == NULL) + pri_a = &lowest; + if (pri_b == NULL) + pri_b = &lowest; + + rv = *pri_a - *pri_b; + + if (pri_a != &lowest) + cal_component_free_priority (pri_a); + if (pri_b != &lowest) + cal_component_free_priority (pri_b); + + return rv; } static GList * |