[evolution-patches] #51187:Alarm crash when I drag and drog a appointment



Dear rodrigo,
I have a patch of bug 51187 on bugzilla for trunk. Would you please help me to review it? You can reproduce the problem following the steps:
      1.Create a  appointment in the calender today.
      2.setup up a alarm for this appointment.
      3.Drag and Drop this appointment to another day, before or after.
  result:
     evolution-alarm-notify crash

Stepping into the source code, I found that the main problem is in the file calendar/gui/alarm-notify/alarm-queue.c, function "query_objects_changed_cb". When returning from the function "e_cal_get_alarms_for_object", the variable "alarms" or "alarms->alarms"maybe NULL. And then, if we've added the component to the hash table before, we can get the corresponding "cqa" to the variable "uid". The program evolution-alarm-notify will be in trouble. In some conditions, the "alarms" is NULL, and trouble happened at the code "(sl = cqa->alarms->alarms; sl; sl = sl->next)"; In some other conditions, the "alarms->alarms" is NULL, and evolution-alarm-notify will crash in the function "remove_comp", the code "g_assert (cqa->queued_alarms != NULL)" will failed. So my opinion is to check the "alarms" and the "alarms->alarms" before proceeding, just as the patch shows. If one of the two variables is NULL, just remove the alarms. Otherwise, update the alarms in the following steps. By the way, I don't understand what the variable "expecting_update" for clearly.

  Thanks a lot.


Best Regards
Alfred Peng
? evolution/calendar/gui/alarm-notify/.notify-main.c.swp
Index: evolution/calendar/gui/alarm-notify/alarm-queue.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/alarm-queue.c,v
retrieving revision 1.59
diff -u -r1.59 alarm-queue.c
--- evolution/calendar/gui/alarm-notify/alarm-queue.c	4 Mar 2004 11:38:58 -0000	1.59
+++ evolution/calendar/gui/alarm-notify/alarm-queue.c	11 Mar 2004 05:49:27 -0000
@@ -325,13 +325,6 @@
 	CompQueuedAlarms *cqa;
 	GSList *l;
 
-	/* No alarms? */
-	if (alarms == NULL || alarms->alarms == NULL) {
-		if (alarms)
-			e_cal_component_alarms_free (alarms);
-		return;
-	}
-
 	cqa = g_new (CompQueuedAlarms, 1);
 	cqa->parent_client = ca;
 	cqa->alarms = alarms;
@@ -541,6 +534,13 @@
 			return;
 		}
 
+		/* if the alarms or the alarms list is empty, just remove it */
+		if (alarms == NULL || alarms->alarms == NULL) {
+			if (alarms)
+				e_cal_component_alarms_free (alarms);
+			continue;
+		}
+
 		cqa = lookup_comp_queued_alarms (ca, uid);
 		if (!cqa)
 			add_component_alarms (ca, alarms);
@@ -575,11 +575,7 @@
 				cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa);
 			}
 
-			if (cqa->queued_alarms == NULL) {
-				if (!cqa->expecting_update)
-					remove_comp (ca, uid);
-			} else
-				cqa->queued_alarms = g_slist_reverse (cqa->queued_alarms);
+			cqa->queued_alarms = g_slist_reverse (cqa->queued_alarms);
 		}
 	}
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]