Re: about textview (gtk_text_buffer_insert_with_tags cause segmentaion fault)



On Tue, 2008-07-15 at 02:09 +0800, æçå wrote:
Hi all ,
When I insert some text to textview in a thread in the following code(myThread::run) . it will segmentation 
fault . 
Could someone help me to fix this issue.
Any comments and suggestion will be welcomed.

bzhu

#include <gtk/gtk.h>
[...]

class myThread:public Thread
{
public :
    void run()
        {
            g_print("Thread is running\n");
            //Code belowe will cause the segmentation fault
            gdk_threads_enter();
            GtkTextBuffer* tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tv));
            GtkTextIter end;
            gtk_text_buffer_get_end_iter(GTK_TEXT_BUFFER(tb),&end);
            gchar text[] = "Thread is running\n";
            gtk_text_buffer_insert_with_tags(GTK_TEXT_BUFFER(tb),&end,text,-1,tag);//segmentaion fault.

You should add `NULL' to the parameter list:

ïgtk_text_buffer_insert_with_tags(GTK_TEXT_BUFFER(tb),
                &end,text,-1,tag, NULL);

            gdk_threads_leave();            
            
        }
};
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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