memory problem ?



Hi, my english is no enough but I will try


in a program I declare a global variable :

gchar *id_cabina_global;
........
.......

in main I allocate :

main( )
{
..........
id_cabina_global = (gchar *)g_malloc(sizeof(LEN_CABINA));
.......
}
in some place :

 id_cabina_global = aux;

in one callback function that I use, which creates a new frame with
information

reporte_dialog()
{

  GtkWidget *hbox_freporte;
  GtkWidget *vbox_freporte;

........................

then I need to use

id_cabina_global

and the value is strange ( not the assigned previously)

but if I make :

if ((hbox_freporte = (GtkWidget *)malloc(sizeof(GtkWidget)) == NULL))
      {
     g_print(".....");
     exit(0);
      }

    if ((vbox_freporte = (GtkWidget *)malloc(sizeof(GtkWidget)) ==
NULL))
      {
     g_print("........");
     exit(0);
      }

the id_cabina_global value is OK .

Why ?

why I need to use malloc in vbox_freporte and hbox_freporte to preserve
id_cabina ?

sorry if my question is stupid but I can't understand the root of
problem

thanks in advance

danilo

=====================================================================






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