Fix for GtkTextView::find crash



testtext crashes on me if I use Edit/Find.

The crash occurs from the idle function first_validate_callback()
when calling gtk_text_view_update_layout_width ().

The exact cause appears to be, that 

widget = GTK_WIDGET (text_view) 

fails, because the text_view is already deallocated/destroyed.
(instance->g_class pointing to garbage)

By removing the idle functions in gtk_text_view_destroy ()
it works.

Ok to apply ?

	Hans

--- from-cvs/gtk+/gtk/gtktextview.c	Fri Nov 02 14:02:12 2001
+++ my-gtk/gtk+/gtk/gtktextview.c	Sun Nov 04 20:10:22 2001
@@ -2173,6 +2173,18 @@
   
   text_view = GTK_TEXT_VIEW (object);
 
+  if (text_view->first_validate_idle != 0)
+    {
+      g_source_remove (text_view->first_validate_idle);
+      text_view->first_validate_idle = 0;
+    }
+
+  if (text_view->incremental_validate_idle != 0)
+    {
+      g_source_remove (text_view->incremental_validate_idle);
+      text_view->incremental_validate_idle = 0;
+    }
+
   layout = text_view->layout;
   
   gtk_text_view_set_buffer (text_view, NULL);

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to 
get along without it.                -- Dilbert



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