Re: [evolution-patches] patch for #62030 (calendar)



On Thu, 2004-08-05 at 16:31 +0200, Rodrigo Moya wrote:
> On Thu, 2004-08-05 at 10:09 -0400, Jeffrey Stedfast wrote:
> > eh? you don't need to g_free() alloca()'d memory.
> > 
> right, valgrind was bailing about this, and didn't see the g_alloca
> call. So, yes, discard this patch.
> 
> The real fix for the bug I was trying to fix is attached.
>
ok, hopefully the last patch, now including a fix in e-icon-factory.c
and some cleanup in the alarm daemon.
-- 
Rodrigo Moya <rodrigo novell com>
? shell/Evolution-Addressbook-SelectNames-common.c
? shell/Evolution-Addressbook-SelectNames-skels.c
? shell/Evolution-Addressbook-SelectNames-stubs.c
? shell/Evolution-Addressbook-SelectNames.h
? shell/glade/Makefile
? shell/glade/Makefile.in
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2475
diff -u -p -r1.2475 ChangeLog
--- calendar/ChangeLog	5 Aug 2004 13:28:03 -0000	1.2475
+++ calendar/ChangeLog	5 Aug 2004 15:09:03 -0000
@@ -1,6 +1,21 @@
+2004-08-05  Rodrigo Moya <rodrigo novell com>
+
+	Fixes #62030
+
+	* gui/alarm-notify/alarm-queue.c (tray_icon_destroyed_cb):
+	only remove the tray icon blinking timeout if we installed
+	it.
+	(display_notification): only install the tray icon blinking
+	timeout if using the system tray.
+	(tray_icon_blink_cb): use g_object_unref instead of the
+	deprecated gdk_pixbuf_unref.
+
+	* gui/alarm-notify/alarm.c (alarm_add): added missing argument
+	documentation.
+
 2004-08-03  JP Rosevear  <jpr novell com>
  
- 	* gui/gnome-cal.c (gnome_calendar_destroy): clean up all the
+	* gui/gnome-cal.c (gnome_calendar_destroy): clean up all the
  	default clients
  	(default_client_cal_opened_cb): change the if statement to a
  	switch to be consistent with the other code bits and set the
@@ -11,15 +26,15 @@
  	source type
  	(gnome_calendar_new_task): bail out if we have no ecal
  
- 	* gui/gnome-cal.c (set_timezone): set the timezone for all the
+	* gui/gnome-cal.c (set_timezone): set the timezone for all the
  	default clients
  
- 	* gui/calendar-component.c (update_primary_task_selection): look
+	* gui/calendar-component.c (update_primary_task_selection): look
 	in the task source list, not the plain source list
 	
 2004-08-05  JP Rosevear  <jpr novell com>
 
- 	* gui/tasks-control.c (tasks_control_sensitize_commands): kill
+	* gui/tasks-control.c (tasks_control_sensitize_commands): kill
  	warning by checking if there is a default client first (can happen
  	when first starting up)
 	
Index: calendar/gui/alarm-notify/alarm-queue.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/alarm-queue.c,v
retrieving revision 1.67
diff -u -p -r1.67 alarm-queue.c
--- calendar/gui/alarm-notify/alarm-queue.c	18 May 2004 14:14:14 -0000	1.67
+++ calendar/gui/alarm-notify/alarm-queue.c	5 Aug 2004 15:09:04 -0000
@@ -236,7 +236,7 @@ remove_queued_alarm (CompQueuedAlarms *c
 	if (remove_alarm) {
 		cqa->expecting_update = TRUE;
 		e_cal_discard_alarm (cqa->parent_client->client, cqa->alarms->comp,
-					  qa->instance->auid, NULL);
+				     qa->instance->auid, NULL);
 		cqa->expecting_update = FALSE;
 	}
 
@@ -776,7 +776,8 @@ tray_icon_destroyed_cb (GtkWidget *tray,
 		tray_data->message = NULL;
 	}
 
-	g_source_remove (tray_data->blink_id);
+	if (tray_data->blink_id)
+		g_source_remove (tray_data->blink_id);
 
 	g_object_unref (tray_data->comp);
 	g_object_unref (tray_data->client);
@@ -901,11 +902,12 @@ tray_icon_blink_cb (gpointer data)
 
 	tray_data->blink_state = tray_data->blink_state == TRUE ? FALSE : TRUE;
 	pixbuf = e_icon_factory_get_icon  (tray_data->blink_state == TRUE ?
-				 	   "stock_appointment-reminder-excl" :
-				 	   "stock_appointment-reminder",
+					   "stock_appointment-reminder-excl" :
+					   "stock_appointment-reminder",
 					   E_ICON_SIZE_LARGE_TOOLBAR);
+
 	gtk_image_set_from_pixbuf (GTK_IMAGE (tray_data->image), pixbuf);
-	gdk_pixbuf_unref (pixbuf);
+	g_object_unref (pixbuf);
 
 	return TRUE;
 }
@@ -1003,13 +1005,13 @@ display_notification (time_t trigger, Co
 	g_signal_connect (G_OBJECT (tray_data->query), "objects_removed",
 			  G_CALLBACK (on_dialog_objs_removed_cb), tray_data);
 
-	tray_data->blink_id = g_timeout_add (500, tray_icon_blink_cb, tray_data);
-
 	if (!config_data_get_notify_with_tray ()) {
+		tray_data->blink_id = -1;
 		open_alarm_dialog (tray_data);
 	} else {
+		tray_data->blink_id = g_timeout_add (500, tray_icon_blink_cb, tray_data);
 		gtk_widget_show (tray_icon);
-	}	
+	}
 }
 
 /* Performs notification of an audio alarm */
Index: calendar/gui/alarm-notify/alarm.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/alarm.c,v
retrieving revision 1.31
diff -u -p -r1.31 alarm.c
--- calendar/gui/alarm-notify/alarm.c	18 May 2004 13:33:40 -0000	1.31
+++ calendar/gui/alarm-notify/alarm.c	5 Aug 2004 15:09:04 -0000
@@ -182,6 +182,7 @@ queue_alarm (AlarmRecord *ar)
  * @trigger: Time at which alarm will trigger.
  * @alarm_fn: Callback for trigger.
  * @data: Closure data for callback.
+ * @destroy_notify_fn: destroy notification callback.
  *
  * Adds an alarm to trigger at the specified time.  The @alarm_fn will be called
  * with the provided data and the alarm will be removed from the trigger list.
Index: e-util/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.473
diff -u -p -r1.473 ChangeLog
--- e-util/ChangeLog	2 Aug 2004 18:34:55 -0000	1.473
+++ e-util/ChangeLog	5 Aug 2004 15:09:05 -0000
@@ -1,3 +1,12 @@
+2004-08-05  Rodrigo Moya <rodrigo novell com>
+
+	Fixes #62030
+
+	* e-icon-factory.c (e_icon_factory_get_icon): malloc normally
+	the icon key, since it will be the key for the hash table.
+	(e_icon_factory_get_icon_list): ditto.
+	(icon_foreach_free): g_free the hash table key.
+
 2004-08-01  JP Rosevear  <jpr novell com>
 
 	* e-pilot-util.c (e_pilot_get_sync_source): find the source with
Index: e-util/e-icon-factory.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-icon-factory.c,v
retrieving revision 1.9
diff -u -p -r1.9 e-icon-factory.c
--- e-util/e-icon-factory.c	3 Jun 2004 15:01:33 -0000	1.9
+++ e-util/e-icon-factory.c	5 Aug 2004 15:09:05 -0000
@@ -196,6 +196,7 @@ e_icon_factory_init (void)
 static void
 icon_foreach_free (gpointer key, gpointer value, gpointer user_data)
 {
+	g_free (key);
 	icon_free (value);
 }
 
@@ -287,7 +288,7 @@ e_icon_factory_get_icon (const char *ico
 			return gdk_pixbuf_scale_simple (broken16_pixbuf, size, size, GDK_INTERP_NEAREST);
 	}
 	
-	icon_key = g_alloca (strlen (icon_name) + 7);
+	icon_key = g_malloc (strlen (icon_name) + 7);
 	sprintf (icon_key, "%dx%d/%s", size, size, icon_name);
 	
 	pthread_mutex_lock (&lock);
@@ -301,11 +302,12 @@ e_icon_factory_get_icon (const char *ico
 			   icon is requested.  */
 			
 			icon = icon_new (icon_key, NULL);
-			g_hash_table_insert (name_to_icon, icon->name, icon);
+			g_hash_table_insert (name_to_icon, icon_key, icon);
 		} else {
-			g_hash_table_insert (name_to_icon, icon->name, icon);
+			g_hash_table_insert (name_to_icon, icon_key, icon);
 		}
-	}
+	} else
+		g_free (icon_key);
 	
 	if ((pixbuf = icon->pixbuf)) {
 		g_object_ref (pixbuf);
@@ -343,15 +345,13 @@ e_icon_factory_get_icon_list (const char
 	
 	pthread_mutex_lock (&lock);
 	
-	icon_key = g_alloca (strlen (icon_name) + 9);
-	
 	for (i = 0; i < G_N_ELEMENTS (icon_list_sizes); i++) {
 		size = icon_list_sizes[i];
-		sprintf (icon_key, "%dx%d/%s", size, size, icon_name);
+		icon_key = g_strdup_printf ("%dx%d/%s", size, size, icon_name);
 		
 		if (!(icon = g_hash_table_lookup (name_to_icon, icon_key))) {
 			if ((icon = load_icon (icon_name, size, FALSE)))
-				g_hash_table_insert (name_to_icon, icon->name, icon);
+				g_hash_table_insert (name_to_icon, icon_key, icon);
 		}
 		
 		if (icon && icon->pixbuf) {


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