Re: gtk_label_get_text() string duping



On Wed, Jun 28, 2000 at 04:24:14PM -0400, Federico Mena Quintero wrote:
> Tim Janik <timj@gtk.org> writes:
> 
> > char *my_label = gtk_label_get_text (foo);
> > 
> > and get a warning if gtk_label_get_text() returns const gchar*.

	THey get a warning, they fix their code.

> Say two threads have a pointer to the label.
> 
> 	Thread 1 is scheduled:
> 
> 		const char *s = gtk_label_get_text (label);
> 
> 	Thread 2 is scheduled:
> 
> 		gtk_label_set_text (label, "squawk");
> 
> 	Thread 1 is scheduled:
> 
> 		printf ("%s is not what I think it is\n", s);
> 
> I guess that is the application's problem, anyways, since it is
> futzing with the label on more than one thread.

	Or doing it w/o threads_enter/leave, which they should be doing
in threaded UI code anyway.

Joel

-- 

"It is not the function of our government to keep the citizen from
 falling into error; it is the function of the citizen to keep the
 government from falling into error."
	- Robert H. Jackson

			http://zenii.uk.linux.org/~jlbec/
			jlbec@evilplan.org




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