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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Nov 8 14:49:27 EET 2007
Author: jobi
Date: 2007-11-08 14:49:26 +0200 (Thu, 08 Nov 2007)
New Revision: 14746

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
   projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c
Log:

2007-11-08  Johan Bilien  <johan.bilien at nokia.com>

	* libhildonwm/hd-wm.c (hd_wm_prepare_close_application_dialog):
	- add a weak reference to the window so it can be set to NULL
	if it disappears.
	- clean up the list where it is constructed.
	* src/hn-app-switcher.c (hn_app_switcher_close_application_dialog):
	- do not clean up the list as it is done by the caller.
	Fixes: NB#74429



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-11-08 12:19:02 UTC (rev 14745)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-11-08 12:49:26 UTC (rev 14746)
@@ -1,5 +1,15 @@
 2007-11-08  Johan Bilien  <johan.bilien at nokia.com>
 
+	* libhildonwm/hd-wm.c (hd_wm_prepare_close_application_dialog):
+	- add a weak reference to the window so it can be set to NULL
+	if it disappears.
+	- clean up the list where it is constructed.
+	* src/hn-app-switcher.c (hn_app_switcher_close_application_dialog):
+	- do not clean up the list as it is done by the caller.
+	Fixes: NB#74429
+
+2007-11-08  Johan Bilien  <johan.bilien at nokia.com>
+
 	* src/hd-home-l10n.h, src/hd-applications-menu-settings-l10n.h,
 	libhildondesktop/statusbar-item-socket.h,
 	libhildondesktop/tasknavigator-item-socket.h: added missing

Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c	2007-11-08 12:19:02 UTC (rev 14745)
+++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c	2007-11-08 12:49:26 UTC (rev 14746)
@@ -330,6 +330,12 @@
   return (ib->vmdata - ia->vmdata);
 }
 
+static void
+hd_wm_cad_item_remove (HDWMCADItem *item)
+{
+  item->win = NULL;
+}
+
 static gboolean
 hd_wm_prepare_close_application_dialog (HDWM *hdwm, HDWMCADAction action, gboolean *retval)
 {
@@ -440,8 +446,12 @@
     item->win = win;
     item->vmdata = hd_wm_get_vmdata_for_pid(pid);
     item->pid = pid;
+    g_object_weak_ref (G_OBJECT (win),
+                       (GWeakNotify)hd_wm_cad_item_remove,
+                       item);
       
     items = g_list_append(items, item);
+
   }
 
   if (g_list_length (items) == 0)
@@ -466,6 +476,18 @@
 
   g_signal_emit_by_name (hdwm, "close-app", action, items, retval);
 
+  for (l = items; l; l = l->next)
+  {
+    HDWMCADItem *item = l->data;
+    if (item->win)
+      g_object_weak_unref (G_OBJECT (item->win),
+                           (GWeakNotify) hd_wm_cad_item_remove,
+                           item);
+
+    g_free (item);
+  }
+  g_list_free (items);
+
   return TRUE;
 }
 

Modified: projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c	2007-11-08 12:19:02 UTC (rev 14745)
+++ projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c	2007-11-08 12:49:26 UTC (rev 14746)
@@ -1454,13 +1454,6 @@
 
   gtk_widget_destroy (dialog);
 
-  /* Cleanup */
-  for (l = items; l; l = l->next)
-  {
-    if (l->data != NULL)
-      g_free (l->data);
-  }
-
   return retval;
 }
 


More information about the maemo-commits mailing list