[evolution] Fix few invalid reads caused by ECanvas



commit 74aec872e619e30533fc3cf6a770df54edeccbdf
Author: Milan Crha <mcrha redhat com>
Date:   Tue Mar 15 13:20:34 2011 +0100

    Fix few invalid reads caused by ECanvas

 widgets/misc/e-canvas.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
index 5bb51f6..05832f7 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -294,7 +294,7 @@ pick_current_item (GnomeCanvas *canvas, GdkEvent *event)
 	if ((canvas->new_current_item != canvas->current_item)
 	    && (canvas->current_item != NULL)
 	    && !canvas->left_grabbed_item) {
-		GdkEvent new_event;
+		GdkEvent new_event = { 0 };
 
 		new_event = canvas->pick_event;
 		new_event.type = GDK_LEAVE_NOTIFY;
@@ -320,7 +320,7 @@ pick_current_item (GnomeCanvas *canvas, GdkEvent *event)
 	canvas->current_item = canvas->new_current_item;
 
 	if (canvas->current_item != NULL) {
-		GdkEvent new_event;
+		GdkEvent new_event = { 0 };
 
 		new_event = canvas->pick_event;
 		new_event.type = GDK_ENTER_NOTIFY;
@@ -511,13 +511,14 @@ canvas_key_event (GtkWidget *widget,
                   GdkEventKey *event)
 {
 	GnomeCanvas *canvas;
-	GdkEvent full_event;
+	GdkEvent full_event = { 0 };
 
 	g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE);
 	g_return_val_if_fail (event != NULL, FALSE);
 
 	canvas = GNOME_CANVAS (widget);
 
+	full_event.type = event->type;
 	full_event.key = *event;
 
 	return canvas_emit_event (canvas, &full_event);
@@ -529,7 +530,7 @@ canvas_focus_in_event (GtkWidget *widget,
 {
 	GnomeCanvas *canvas;
 	ECanvas *ecanvas;
-	GdkEvent full_event;
+	GdkEvent full_event = { 0 };
 
 	canvas = GNOME_CANVAS (widget);
 	ecanvas = E_CANVAS (widget);
@@ -543,6 +544,7 @@ canvas_focus_in_event (GtkWidget *widget,
 	gtk_im_context_focus_in (ecanvas->im_context);
 
 	if (canvas->focused_item) {
+		full_event.type = event->type;
 		full_event.focus_change = *event;
 		return canvas_emit_event (canvas, &full_event);
 	} else {
@@ -556,7 +558,7 @@ canvas_focus_out_event (GtkWidget *widget,
 {
 	GnomeCanvas *canvas;
 	ECanvas *ecanvas;
-	GdkEvent full_event;
+	GdkEvent full_event = { 0 };
 
 	canvas = GNOME_CANVAS (widget);
 	ecanvas = E_CANVAS (widget);
@@ -570,6 +572,7 @@ canvas_focus_out_event (GtkWidget *widget,
 	gtk_im_context_focus_out (ecanvas->im_context);
 
 	if (canvas->focused_item) {
+		full_event.type = event->type;
 		full_event.focus_change = *event;
 		return canvas_emit_event (canvas, &full_event);
 	} else {
@@ -634,7 +637,7 @@ e_canvas_item_grab_focus (GnomeCanvasItem *item,
 {
 	GnomeCanvasItem *focused_item;
 	GdkWindow *bin_window;
-	GdkEvent ev;
+	GdkEvent ev = { 0 };
 
 	g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
 	g_return_if_fail (gtk_widget_get_can_focus (GTK_WIDGET (item->canvas)));
@@ -644,6 +647,7 @@ e_canvas_item_grab_focus (GnomeCanvasItem *item,
 	focused_item = item->canvas->focused_item;
 
 	if (focused_item) {
+		ev.type = GDK_FOCUS_CHANGE;
 		ev.focus_change.type = GDK_FOCUS_CHANGE;
 		ev.focus_change.window = bin_window;
 		ev.focus_change.send_event = FALSE;



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