GtkWidget is segfaulting



Hi,

I came across a strange segfault in a program that uses a GtkText
widget. I was able to reproduce the bug in a very small application. But
I was not able to track the bug down to it's roots completely. I
included the source code as an attachment to this mail.

To reproduce the bug, compile the source code, start ./text and click
with any mouse button into the client area of the GtkText widget.

What it does: The trick with the mouseclick is just to assure the widget
has the focus. In the mouse button click signal handler it basically
does the following:

--
  gtk_text_freeze ( GTK_TEXT (text));
  
  my_insert ("--a");
  gtk_text_set_point ( GTK_TEXT (text), 1);
  my_insert ("-");
 
  gtk_text_set_point ( GTK_TEXT (text), 0);
  gtk_text_forward_delete ( GTK_TEXT (text), 3);

  my_insert ("--a");

  // boom, programm segfaults here!
  gtk_editable_set_position (GTK_EDITABLE (text), 2);

  gtk_text_thaw ( GTK_TEXT (text));
--
where `my_insert' is a simple function that insert text with a call to
`gtk_text_insert', it uses a certain font for it. (If I pass NULL as
font, the program does _not_ segfault).

The crazy thing is, that when I don't freeze and thaw the program also
works fine, without segfaulting!


I think this is a bug in GTK, because I cannot find something invalid in
my code. (Although I would be glad to hear otherwise :). I would greatly
appreciate if anybody can shed some light on this.


many thanks in advance,
Andreas
PS: I am using GTK 1.2.4, glibc 2.1, Kernel 2.0.36, Debian Distribution,
gcc 2.95.1

gtk_widget_segfault.tar.gz



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