Re: Text widget crashing



Owen Taylor <otaylor@redhat.com> wrote:

> Anders Melchiorsen <and@kampsax.dtu.dk> writes:
> 
> > Following up on my own message:
> > 
> > > While editing a text, I marked a region and pressed the Delete key
> > > to remove it. My application crashed :-(. Here is a backtrace for
> > > Gtk+ 1.2.5. The crash seems to happen only when the widget has to do
> > > scrolling to delete the text.
> > 
> > I have now confirmed this bug in 1.2.6 and furthermore found a way to
> > reproduce it in testgtk: First pick the "text" demo from the main
> 
> If somebody provides a patch that looks like it makes sense, I'll
> apply it, but I don't plan on doing any more maintainence on

So, I spent a few hours (half a day, actually) hunting this one. I
finally found that it occurs when deleting text containing several
different text properties.  Furthermore, the widget must be
frozen. Therefore, deleting more than FREEZE_LENGTH characters will
also make it happen.

When thawing, the text widget will often try scrolling to get back on
track. This includes undrawing the cursor and that causes the crash
since the cursor is not yet updated for the new situation.

I tried several things to fix it. The following patch was the best I
could do. It removes the cursor while the text widget is frozen and
seems to do the trick for me. Both of my repeatable testcases are now
working properly (including the testgtk one).

Unless the patch is fundamentally flawed, I urge you to put it in. It
fixes a very real bug here and does so at little cost. The text widget
is the main part of my application and although the bug rarely shows,
it really is annoying to always be running that little risk.

Thanks,
Anders


--- gtktext.c.orig Sat Sep  4 00:20:39 1999
+++ gtktext.c   Thu Oct 21 01:45:00 1999
@@ -903,6 +903,7 @@
   g_return_if_fail (GTK_IS_TEXT (text));
   
   text->freeze_count++;
+  undraw_cursor (text, FALSE);
 }
 
 void
@@ -917,6 +918,7 @@
        recompute_geometry (text);
        gtk_widget_queue_draw (GTK_WIDGET (text));
       }
+  draw_cursor (text, FALSE);
 }
 
 void

-- 



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