something strange with GtkNotebook



hi, in resume , I have a struct as following :

typedef struct tab
   {
   GtkNotebook *note;
   /* Misc datas */
   struct tab *next;
   struct tab *previous;
   }
typedef tab* list;
typedef list* plist;
plist LIST1;

I just wanted to implement a chained list in parallel to notebook and act on the list following the removal or additions of tabs in the notebooks.

I initialized a plist of any number of tab(with NULL for previous of the first,and for the last element , next value NULL, notebook is initialized too, the last tab is the one activated).
nothing strange here.
but
at this point, next==NULL, and previous point to the previous struct tab*.

I do the following

int nb=gtk_notebook_get_current_page((*LIST1)->note));
gtk_notebook_remove_page((*LIST1)->note,nb);
g_print("%d",(*LIST1)->next);


the g_print displays me an integer value : 135508240



BUT, if I put the g_print BEFORE the gtk_notebook_remove_page, it displays right the value 0, as it is set to NULL. I have look for the problem for a few minutes, and I don' t understand why the removing cause the next value tu be modified.

g_print("%d",(*LIST1)->next);
int nb=gtk_notebook_get_current_page((*LIST1)->note));
gtk_notebook_remove_page((*LIST1)->note,nb);

It is not a problem, since I can put the removal of tab after I treat the next and previous to link to the right struct, but I d like to understand why it does this.


Axel




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