[maemo-commits] [maemo-commits] r14143 - in projects/haf/trunk/hildon-desktop: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Sep 27 14:06:23 EEST 2007
Author: jobi
Date: 2007-09-27 14:06:21 +0300 (Thu, 27 Sep 2007)
New Revision: 14143

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/src/hd-switcher-menu-item.c
   projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c
   projects/haf/trunk/hildon-desktop/src/hn-app-pixbuf-anim-blinker.c
Log:

2007-09-27 Johan Bilien  <johan.bilien at nokia.com>

	Refactored memory management of the switcher icons
	* src/hd-switcher-menu-item.c
	- (hd-switcher-menu-item_set_property): keep an internal reference
	to the notification icon
	- (hd_switcher_menu_item_icon_animation): when moving from
	animation to static, do not unref the original pixbuf
	* src/hn-app-pixbuf-anim-blinker.c
	(hn_app_pixbuf_anim_blinker_finalize): unref the blended image
	* src/hd-switcher-menu.c: unref a notification icon after
	a notification menu item is created
	Fixes: NB#70872, NB#70670



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-09-27 10:31:39 UTC (rev 14142)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-09-27 11:06:21 UTC (rev 14143)
@@ -1,3 +1,17 @@
+2007-09-27 Johan Bilien  <johan.bilien at nokia.com>
+
+	Refactored memory management of the switcher icons
+	* src/hd-switcher-menu-item.c
+	- (hd-switcher-menu-item_set_property): keep an internal reference
+	to the notification icon
+	- (hd_switcher_menu_item_icon_animation): when moving from
+	animation to static, do not unref the original pixbuf
+	* src/hn-app-pixbuf-anim-blinker.c
+	(hn_app_pixbuf_anim_blinker_finalize): unref the blended image
+	* src/hd-switcher-menu.c: unref a notification icon after
+	a notification menu item is created
+	Fixes: NB#70872, NB#70670
+
 2007-09-27  Lucas Rocha  <lucas.rocha at nokia.com>
 
 	* src/hd-applications-menu.c (hd_applications_menu_activate_category):

Modified: projects/haf/trunk/hildon-desktop/src/hd-switcher-menu-item.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-switcher-menu-item.c	2007-09-27 10:31:39 UTC (rev 14142)
+++ projects/haf/trunk/hildon-desktop/src/hd-switcher-menu-item.c	2007-09-27 11:06:21 UTC (rev 14143)
@@ -211,6 +211,8 @@
       
     case MENU_PROP_NOT_ICON:
       priv->notification_icon = g_value_get_object (value);
+      if (priv->notification_icon)
+        g_object_ref (priv->notification_icon);
       break;
       
     case MENU_PROP_DBUS_CALLBACK:
@@ -277,7 +279,7 @@
 
 static void
 hd_switcher_menu_item_icon_animation (GtkWidget *icon,
-	       			 gboolean   is_on)
+                                      gboolean   is_on)
 {
   GdkPixbuf *pixbuf;
   GdkPixbufAnimation *pixbuf_anim;
@@ -306,7 +308,8 @@
 
     gtk_image_set_from_pixbuf (GTK_IMAGE (icon), pixbuf);
 
-    g_object_unref (pixbuf);
+    
+
   }
 }
 

Modified: projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c	2007-09-27 10:31:39 UTC (rev 14142)
+++ projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c	2007-09-27 11:06:21 UTC (rev 14143)
@@ -718,6 +718,9 @@
     menu_item = hd_switcher_menu_item_new_from_notification_group
       (ngroup->notifications, icon, summary, ngroup->dbus_callback, TRUE);
 
+    if (icon)
+      g_object_unref (icon);
+
     gtk_widget_set_name (GTK_WIDGET (menu_item), 
       		         HD_SWITCHER_MENU_NOT_MENU_ITEM_NAME);
 
@@ -1387,6 +1390,7 @@
 
     image_blinking = gtk_image_new ();
     gtk_image_set_from_animation (GTK_IMAGE (image_blinking), icon_blinking);
+    g_object_unref (icon_blinking);
 
     if (image_blinking)
     {    
@@ -1823,12 +1827,20 @@
 
         if (!ack && !icon_is_set)
         {
+          GdkPixbuf *icon;
+
 	  switcher->priv->blinking_notification = id;
 
-          hd_switcher_menu_replace_blinking_icon (switcher, 
-			  			  hd_switcher_menu_get_icon_from_theme (icon_name,
-											AS_ICON_SIZE));
+          icon = hd_switcher_menu_get_icon_from_theme (icon_name,
+                                                       AS_ICON_SIZE);
+          if (icon)
+          {
+            hd_switcher_menu_replace_blinking_icon (switcher,
+                                                    icon);
 
+            g_object_unref (icon);
+          }
+
           icon_is_set = TRUE;
 	}
 
@@ -1836,6 +1848,8 @@
 	  first_item = menu_item;
       }
 
+      if (icon)
+        g_object_unref (icon);
       g_free (icon_name);
       g_free (summary);
       g_free (body);

Modified: projects/haf/trunk/hildon-desktop/src/hn-app-pixbuf-anim-blinker.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hn-app-pixbuf-anim-blinker.c	2007-09-27 10:31:39 UTC (rev 14142)
+++ projects/haf/trunk/hildon-desktop/src/hn-app-pixbuf-anim-blinker.c	2007-09-27 11:06:21 UTC (rev 14143)
@@ -124,6 +124,7 @@
         anim = HN_APP_PIXBUF_ANIM_BLINKER (object);        
         
         g_object_unref (anim->pixbuf);
+        g_object_unref (anim->blended);
         
         G_OBJECT_CLASS (hn_app_pixbuf_anim_blinker_parent_class)->
         	finalize (object);


More information about the maemo-commits mailing list