Re: A problem about programming with gtk+ in multiprocess.



ÀîÓê <raise_sail sina com> writes:
>     case 0: 
>       {
>  /* in child process , i change text of GtkLabel, and update it */
> 	time_t t;
> 	char* chartime;
> 	gchar* text, *newtext;
> 	time(&t);
> 	chartime = g_strdup(ctime(&t)) ;
> 	gtk_label_get(GTK_LABEL(cb_data->label), &text);
> 	newtext = g_strdup_printf("%s%s",text, chartime);
> 	gtk_label_set_text(GTK_LABEL(cb_data->label), chartime);


You just don't understand what the child process is. Processes don't
share memory with each other. So you can't use widgets from one
process inside another process.

If you want to do stuff like this, you need to use threads; see
www.gtk.org/faq for info on threads with GTK.

Havoc



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