Writing to a buffer



I presently have a buffer that I create:

    pmsg_buffer = GTK_WIDGET(gtk_text_buffer_new(NULL));
    pmsg_text_view = gtk_text_view_new_with_buffer(GTK_TEXT_BUFFER(
      pmsg_buffer));
    gtk_widget_show(pmsg_text_view);
    gtk_widget_show(pmsg_buffer);

and then update from a function by inserting text at the end:

    GtkTextIter *iterator;
    g_print("New_pmsg 1\n");
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(pmsg_buffer), "\n",
      strlen("\n"));
    g_print("New_pmsg 2\n");
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(pmsg_buffer), message,
      strlen(message));
    g_print("New_pmsg 3\n");
    gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(pmsg_buffer), iterator);
    g_print("New_pmsg 4\n");
    g_print("New_pmsg 5\n");
    gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(pmsg_text_view), iterator,
      0.0f, 1, 0.0f, 1.0f);
    g_print("New_pmsg 6\n");

When I run it, the function behaves as expected the first time (the text is displayed).

On subsequent runs, it doesn't appear to display any of the new text. There are error messages:

New_pmsg 1

(gtk_tms:12510): GLib-GObject-WARNING **: invalid uninstantiatable type `GdkWindow' in cast to `GdkWindow'

(gtk_tms:12510): GLib-GObject-WARNING **: instance of invalid non-instantiatable type `GdkWindow'

(gtk_tms:12510): GLib-GObject-CRITICAL **: g_signal_emit_valist: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed
New_pmsg 2

(gtk_tms:12510): GLib-GObject-WARNING **: invalid uninstantiatable type `GdkWindow' in cast to `GdkWindow'

(gtk_tms:12510): GLib-GObject-WARNING **: instance of invalid non-instantiatable type `GdkWindow'

(gtk_tms:12510): GLib-GObject-CRITICAL **: g_signal_emit_valist: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed
New_pmsg 3

(gtk_tms:12510): GLib-GObject-WARNING **: invalid uninstantiatable type `GdkWindow' in cast to `GdkWindow'
New_pmsg 4
New_pmsg 5
New_pmsg 6

Is it interpreting the output of gtk_text_buffer_new() as a GdkWindow? I don't have any other code that refers to pmsg_buffer. What should I do next?
--
++ Jonathan Hayward, jonathan hayward pobox com
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail (gmail.com) account, please tell me!

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