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

Re: possible bug



gchar *somestring;


void
some_callback_function(widget, user_data)
{
	somestring = some_other_string;
}

as long as this is done in a callback function, the string stays. if it is 
done in a function that is not a callback function, when the program goes 
into the gtk_main() loop the string is cleared(?) to a null string. the 
address of the pointer is still the same, but the data is off in the bit 
bucket somewhere. i used the term initializing incorrectly in this context. i 
am actually assigning values from a MySQL database, and it's the initial 
loading of all the variables.
Jeffrey
On Wednesday 01 January 2003 14:48, Harring Figueiredo wrote:
>  If you post your coded snipet it would help us find the problem.
>
>  What do you mean by initializing ?
>
>  foo(){
>  gchar*  c =  "something" ;
> }
>
>   foo(){
>   gchar* c = strdup("something");
>
> }
>
>  Both initialize, but have different memory context.
>
>  Again, posting the code would help.
>
> Harring.




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