[gtksourceview] CompletionInfo: avoid infinite loop



commit a700e9539f6112cd3a3cf27ca237f2d67117b6f8
Author: SÃbastien Wilmet <swilmet gnome org>
Date:   Sun Feb 10 20:11:16 2013 +0100

    CompletionInfo: avoid infinite loop

 gtksourceview/gtksourcecompletioninfo.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletioninfo.c b/gtksourceview/gtksourcecompletioninfo.c
index de6e2ed..9b8996a 100644
--- a/gtksourceview/gtksourcecompletioninfo.c
+++ b/gtksourceview/gtksourcecompletioninfo.c
@@ -87,6 +87,8 @@ idle_resize (GtkSourceCompletionInfo *info)
 	guint border_width;
 	gint window_width;
 	gint window_height;
+	gint cur_window_width;
+	gint cur_window_height;
 
 	g_assert (child != NULL);
 
@@ -99,9 +101,15 @@ idle_resize (GtkSourceCompletionInfo *info)
 	window_width = nat_size.width + 2 * border_width;
 	window_height = nat_size.height + 2 * border_width;
 
-	gtk_window_resize (GTK_WINDOW (info),
-			   MAX (1, window_width),
-			   MAX (1, window_height));
+	gtk_window_get_size (GTK_WINDOW (info), &cur_window_width, &cur_window_height);
+
+	/* Avoid an infinite loop */
+	if (cur_window_width != window_width || cur_window_height != window_height)
+	{
+		gtk_window_resize (GTK_WINDOW (info),
+				   MAX (1, window_width),
+				   MAX (1, window_height));
+	}
 
 	return FALSE;
 }


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