[Galago-commits] r2946 - in trunk/notification-daemon: . src/themes/standard

galago-commits at freedesktop.org galago-commits at freedesktop.org
Thu Nov 9 16:43:44 PST 2006


Author: chipx86
Date: 2006-11-09 16:43:37 -0800 (Thu, 09 Nov 2006)
New Revision: 2946

Modified:
   trunk/notification-daemon/ChangeLog
   trunk/notification-daemon/src/themes/standard/theme.c
Log:
Fix a crash caused by destroying an already freed array of points during the destruction of windows with arrows.


Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog	2006-11-10 00:35:50 UTC (rev 2945)
+++ trunk/notification-daemon/ChangeLog	2006-11-10 00:43:37 UTC (rev 2946)
@@ -1,3 +1,9 @@
+Thu Nov 09 16:42:58 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* src/themes/standard/theme.c:
+	  - Fix a crash caused by destroying an already freed array of points
+	    during the destruction of windows with arrows.
+
 Thu Nov 09 16:35:34 PST 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/themes/standard/theme.c:

Modified: trunk/notification-daemon/src/themes/standard/theme.c
===================================================================
--- trunk/notification-daemon/src/themes/standard/theme.c	2006-11-10 00:35:50 UTC (rev 2945)
+++ trunk/notification-daemon/src/themes/standard/theme.c	2006-11-10 00:43:37 UTC (rev 2946)
@@ -139,7 +139,7 @@
 	int arrow_side1_width = DEFAULT_ARROW_WIDTH / 2;
 	int arrow_side2_width = DEFAULT_ARROW_WIDTH / 2;
 	int arrow_offset = DEFAULT_ARROW_OFFSET;
-	GdkPoint *shape_points;
+	GdkPoint *shape_points = NULL;
 	int i = 0;
 
 	width  = windata->width;
@@ -321,10 +321,13 @@
 			break;
 	}
 
-	windata->window_region =
-		gdk_region_polygon(shape_points, windata->num_border_points,
-						   GDK_EVEN_ODD_RULE);
-	g_free(shape_points);
+	if (shape_points != NULL)
+	{
+		windata->window_region =
+			gdk_region_polygon(shape_points, windata->num_border_points,
+							   GDK_EVEN_ODD_RULE);
+		g_free(shape_points);
+	}
 }
 
 static gboolean
@@ -334,9 +337,6 @@
 {
 	fill_background(win, windata);
 
-	if (windata->has_arrow)
-		create_border_with_arrow(win, windata);
-
 	if (windata->gc == NULL)
 	{
 		GdkColor color;
@@ -348,11 +348,14 @@
 
 	if (windata->has_arrow)
 	{
+		create_border_with_arrow(win, windata);
+
 		gdk_draw_polygon(win->window, windata->gc, FALSE,
 						 windata->border_points, windata->num_border_points);
 		gdk_window_shape_combine_region(win->window, windata->window_region,
 										0, 0);
 		g_free(windata->border_points);
+		windata->border_points = NULL;
 	}
 	else
 	{
@@ -371,9 +374,6 @@
 	if (windata->gc != NULL)
 		g_object_unref(G_OBJECT(windata->gc));
 
-	if (windata->border_points != NULL)
-		g_free(windata->border_points);
-
 	if (windata->window_region != NULL)
 		gdk_region_destroy(windata->window_region);
 



More information about the galago-commits mailing list