--- rpl/src/gestion_variables.c 2012/10/05 13:12:39 1.60 +++ rpl/src/gestion_variables.c 2012/10/08 07:37:06 1.63 @@ -237,7 +237,7 @@ liste_variables_par_feuilles(struct_proc ================================================================================ */ -static inline struct_arbre_variables * +struct_arbre_variables * allocation_noeud(struct_processus *s_etat_processus) { struct_arbre_variables *objet; @@ -272,7 +272,7 @@ liberation_noeud(struct_processus *s_eta return; } -static inline struct_arbre_variables ** +struct_arbre_variables ** allocation_tableau_noeuds(struct_processus *s_etat_processus) { struct_arbre_variables **objet; @@ -1712,6 +1712,8 @@ liberation_arbre_variables(struct_proces free((*(*l_element_statique_courant).variable).nom); liberation(s_etat_processus, (*(*l_element_statique_courant) .variable).objet); + free((*l_element_statique_courant).variable); + free(l_element_statique_courant); l_element_statique_courant = l_element_statique_suivant; } @@ -1956,6 +1958,7 @@ copie_arbre_variables(struct_processus * struct_liste_variables_statiques *l_element_statique_courant; struct_variable s_variable; + struct_variable_statique s_variable_statique; unsigned char *ptr; @@ -2179,8 +2182,31 @@ copie_arbre_variables(struct_processus * ptr++; } + // Il faut copier la variable pour la dissocier de la variable + // restant dans le thread parent. + + s_variable_statique = (*(*l_element_statique_courant).variable); + + if (copie_objet(s_etat_processus, s_variable_statique.objet, 'P') + == NULL) + { + (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; + return; + } + + if ((s_variable_statique.nom = malloc((strlen( + (*(*l_element_statique_courant).variable).nom) + 1) * + sizeof(unsigned char))) == NULL) + { + (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; + return; + } + + strcpy(s_variable_statique.nom, (*(*l_element_statique_courant) + .variable).nom); + if (creation_variable_statique(s_nouvel_etat_processus, - (*l_element_statique_courant).variable) == d_erreur) + &s_variable_statique) == d_erreur) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return;