Re: Losing GtkTextBuffer when threading



On Mon, 2005-10-10 at 19:51, Dan McKinnon wrote:
typedef struct networktype{
    ...
    GtkTextBuffer *output_buffer;
    ..
} networktype;

void append_to_buffer( GtkTextBuffer *output_buffer, char *text ){
    GtkTextIter output_end;
    gtk_text_buffer_get_end_iter( output_buffer, &output_end );   
    gtk_text_buffer_insert( output_buffer, &output_end, text, -1 );
}

int net_init( networktype *net, GtkTextBuffer *buf ){
    net->output_buffer = buf;
    append_to_buffer( net->output_buffer, "Initilizing Network\n");
    ...
}

void *net_thread( void *args ){
    ...  
    append_to_buffer( net->output_buffer, "Getting host by name\n");
}

in the main function I've done everything right, as far as I know:
    g_thread_init( NULL );
    gdk_threads_init();
    gdk_threads_enter();
    net_init( &net, txtoutput_buffer);
    pthread_create( &net->thread, NULL, net_thread, &net );

What's going on here?

Is there anywhere a call to gtk_text_buffer_new() ?

-- 
Alan M. Evans <ame1 extratech com>




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