Re: Text widget crashing



On 21 Oct 1999, Anders Melchiorsen wrote:

> 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);
>  }

if at all (and the reasonings you give actually sound very plausible
to me) you should redraw the cursor as:

void
gtk_text_thaw (GtkText *text)
{
  g_return_if_fail (text != NULL);
  g_return_if_fail (GTK_IS_TEXT (text));

  if (text->freeze_count)
    if (!(--text->freeze_count) && GTK_WIDGET_REALIZED (text))
      {
        recompute_geometry (text);
        gtk_widget_queue_draw (GTK_WIDGET (text));
+       draw_cursor (text, FALSE);
      }
}

to correctly honour the freeze count.

---
ciaoTJ



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