changeset 32636:1c9d68bfb7d8

don't crash when switching tabs
author Marcus Lundblad <ml@update.uu.se>
date Mon, 29 Nov 2010 08:05:42 +0000
parents 45625ed0a985
children 4d6419c3e067
files pidgin/gtkconv.c
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Mon Nov 29 07:30:49 2010 +0000
+++ b/pidgin/gtkconv.c	Mon Nov 29 08:05:42 2010 +0000
@@ -4675,15 +4675,15 @@
 	int min_height;
 	gboolean interior_focus;
 	int focus_width;
-  GtkAllocation imhtml_allocation;
-  GtkAllocation entry_allocation;
-  GtkAllocation lower_hbox_allocation;
+	GtkAllocation imhtml_allocation;
+	GtkAllocation entry_allocation;
+	GtkAllocation lower_hbox_allocation;
     
-  gtk_widget_get_allocation(gtkconv->imhtml, &imhtml_allocation);
-  gtk_widget_get_allocation(gtkconv->entry, &entry_allocation);
-  gtk_widget_get_allocation(gtkconv->lower_hbox, &lower_hbox_allocation);
-  total_height = imhtml_allocation.height + entry_allocation.height;
-  max_height = total_height / 2;
+	gtk_widget_get_allocation(gtkconv->imhtml, &imhtml_allocation);
+	gtk_widget_get_allocation(gtkconv->entry, &entry_allocation);
+	gtk_widget_get_allocation(gtkconv->lower_hbox, &lower_hbox_allocation);
+	total_height = imhtml_allocation.height + entry_allocation.height;
+	max_height = total_height / 2;
     
 	pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry));
 	pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry));
@@ -4721,6 +4721,9 @@
 	if (ABS(diff) < oneline.height / 2)
 		return FALSE;
 
+	purple_debug_info("pidgin", "resizing to %d, %d lines\n",
+	                  lower_hbox_allocation.height, min_lines);
+
 	gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
 		diff + lower_hbox_allocation.height);
 
@@ -7309,11 +7312,11 @@
 	count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook));
 
 	for (i = 0; i < count; i++) {
-    GtkAllocation allocation;
-
-    gtk_widget_get_allocation(tab, &allocation);
+    	GtkAllocation allocation;
+
 		page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i);
 		tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page);
+		gtk_widget_get_allocation(tab, &allocation);
 
 		/* Make sure the tab is not hidden beyond an arrow */
 		if (!gtk_widget_is_drawable(tab) && gtk_notebook_get_show_tabs(notebook))