QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1214|回复: 1

gtk_text_buffer_insert()函数help

[复制链接]
发表于 2006-5-6 19:52:54 | 显示全部楼层 |阅读模式
我写一个往gtktextview中插入数据的函数,
void
insert_text_to_text4 (gchar * data)
{
   GtkTextBuffer *buffer;
   GtkTextIter end;
   buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text4)); //text4是一个gtktextview控件
   gtk_text_buffer_get_end_iter(buffer,&end);
   gtk_text_buffer_insert(buffer, &end, data, -1);
   gtk_text_buffer_get_end_iter(buffer,&end);
   gtk_text_buffer_insert(buffer, &end, "\n", -1);
}

在进行插入的时候大部分时候正常.但偶尔会出现如下的错误:
Gtk-WARNING **: Invalid text buffer iterator: either the iterator is uninitialized, or the characters/pixbufs/widgets in the buffer have been modified since the iterator was created.
You must use marks, character numbers, or line numbers to preserve a position across buffer modifications.
You can apply tags and insert marks without invalidating your iterators,
but any mutation that affects 'indexable' buffer contents (contents that can be referred to by character offset)
will invalidate all outstanding iterators
段错误
发表于 2006-5-14 18:54:02 | 显示全部楼层
buffer有可能为空  
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-2 16:26 , Processed in 0.040738 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表