GtkTextBuffer doesn't like non newline-terminated strings.



Hi all,

When porting Script-Fu, i added the following code to display a greeting
text with multiple fonts:

gimp/plug-ins/script-fu/script-fu-console.c:231:

const gchar *greeting_texts[] =
{
  "strong",   "The GIMP - GNU Image Manipulation Program\n\n",
  "emphasis", "Copyright (C) 1995-2001\n",
  "emphasis", "Spencer Kimball, Peter Mattis and the GIMP Development Team\n",
  "weak",     "\nThis program is free software; you can redistribute it and/or modify\n",

  (blah)

  "strong",   "Script-Fu Console - ",
  "emphasis", "Interactive Scheme Development\n\n",
  NULL
};

GtkTextIter cursor;
gint        i;

gtk_text_buffer_get_end_iter (cint.console, &cursor);

for (i = 0; greeting_texts[i]; i += 2)
{
  gtk_text_buffer_insert_with_tags_by_name (cint.console, &cursor,
					    greeting_texts[i + 1], -1,
					    greeting_texts[i],
					    NULL);
}


However this badly crashes with

script-fu (pid:23873): Gtk-ERROR **: file gtktextiter.c: line 1723 (forward_line_leaving_caches_unmodified): assertion failed: (real->segment->char_count == 1)
aborting...

when it encounters the non-newline terminated

   "strong",   "Script-Fu Console - ",

line.

Unless i got the meaning of the end_iter wrong, this looks like a bug
in GtkTextIter.

BTW, moving the gtk_text_buffer_get_end_iter() into the for() loop doesn't
change anything.

ciao,
--Mitch




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