The window buffer of a text grid must be flushed before line input
begins; line input replaces part of the text with a widget (GtkEntry)
so if the buffer is flushed during, then it overwrites the widget,
deleting it, and causing a crash.
static void
text_grid_request_line_event_common(winid_t win, glui32 maxlen, gboolean insert, gchar *inserttext)
{
+ /* All outstanding printing _must_ be finished before putting an input entry
+ into the buffer */
+ flush_window_buffer(win);
+
gdk_threads_enter();
GtkTextBuffer *buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(win->widget) );