GtkLabel trouble #2



Original posting reproduce for context:

>Why is it that if I use gtk_label_get, I get a seg fault if I then try
>and use gtk_label_set_text ?
>
>e.g. I want to get the text of a label and use the text to determine
>whether I need to change the text of the same label:
>
>        gtk_label_get(GTK_LABEL(label_pointer), pText);
>
>        if ( pText contains something or other)
>                  gtk_label_set_text(GTK_LABEL(label_pointer),
>"something else...");
>
 

Furthermore, I found the following to be quite confusing:

This code works fine, without seg faulting:

  gchar *pText;

   gtk_label_get(GTK_LABEL(label_pointer), &pText);

  gtk_label_set_text(GTK_LABEL(label_pointer), "fred");
 

BUT, this code does not:

  gchar **pText;

   gtk_label_get(GTK_LABEL(label_pointer), pText);

  gtk_label_set_text(GTK_LABEL(label_pointer), "fred");
 
 
 

Subtly different, but why does one work and not the other?

Jered.



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