Strange behavior...



Hello,

  I´ve a big problem with the following code at the end. When I try
to replace a selected clipboard with a new string, which is shorter
than the clipboard, I get the following message and the programm quits.

Message:
Gtk-ERROR **: file gtktext.c: line 4712 (find_line_params): assertion
failed: (lp.end.property)
aborting...  

But just in case the new string is shorter, otherwise everything works
fine. I found out that the error occured in the marked (*) line, but
I don´t know why. Could someone help me with that odd behavior? 
Thanks for your help and time... 


Here´s the code snippet (textwindow is a global widget):
void
g_edit_replace_cb (GtkWidget *unused, gpointer entry)
{
    gint position;
    gint end;
    
    position = GTK_EDITABLE(textwindow)->selection_start_pos;
    gtk_text_freeze (GTK_TEXT(textwindow));
    gtk_editable_cut_clipboard (GTK_EDITABLE(textwindow));
    gtk_text_insert (GTK_TEXT(textwindow), NULL, NULL, NULL,
                     gtk_editable_get_chars(GTK_EDITABLE(entry),0,-1),-1);
    gtk_text_set_point (GTK_TEXT(textwindow), position);
    gtk_text_insert (GTK_TEXT(textwindow), NULL, NULL, NULL, " ", 1);
    gtk_text_backward_delete (GTK_TEXT(textwindow), 1);    
    end = position +
(strlen(gtk_editable_get_chars(GTK_EDITABLE(entry),0,-1)));
(*) gtk_editable_select_region (GTK_EDITABLE(textwindow), position,
end);
    gtk_text_thaw (GTK_TEXT(textwindow));
    return;
}

Markus Harz
Geodetic Institute of the RWTH Aachen, Germany




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