Re: help regarding the combobox



Hello,

Am Freitag, den 08.04.2005, 11:10 +0530 schrieb poonam chokshi:
hello,

I am using the combobox in the heirarchy as shown
-Main window
      -secframe
              -secfixed
                      -seccmb
Now i am trying to add some data to the the combo box usingthe g_list_append()
function in my own callback defined in the callback.c ..But it gives
me the segmentationfault
My function goes like this....

int parse_ini_file(char * ini_name)
{        
      int i=0;   
      GtkWidget *seccmbentry;
      GList *items=NULL;
      GList *seccmb_items=NULL;
      
      ini = iniparser_load(ini_name); //library function that i am using
        if (ini==NULL)
        {
                fprintf(stderr, "cannot parse file [%s]", ini_name);
                return -1 ;
        }
      section=iniparser_getnsec(ini); //library function that will return the count
      printf("the number of sections:%d\n",section);
              seccmbentry = GTK_COMBO (seccmb)->entry;
      for(i=0;i<=section-1;i++)
      {
              seccmb_items=iniparser_getsecname(ini,i); //library function
              printf("Items=%s\n",seccmb_items);
              items=g_list_append(items,seccmb_items); //giving segmentation fault over here

Are you sure that the segmentation fault happens here?

      }
      
      gtk_entry_set_text (GTK_ENTRY (seccmbentry), seccmb_items);

The possibility that i could happen here is greater.

I don't see that you are checking seccmb_items, seccmbentry or seccmb
against NULL-pointer.
Perhaps they are NULL...

Best regards

Juergen




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