Je tourne autour d'un problème depuis un petit moment maintenant donc je fait appel à des yeux neufs
Suppression d'un noeud de ma liste double :
Appel de la fermeture de la liste:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 DECLSPEC void b_list_remove_node (BList * p_list, BList * p_node) { if (p_node) { if (p_node->p_prev) p_node->p_prev->p_next = p_node->p_next; if (p_node->p_next) p_node->p_next->p_prev = p_node->p_prev; if (p_node == p_list) p_list = p_list->p_next; p_node->p_prev = NULL; p_node->p_next = NULL; #ifdef BLIB_MEM_TRACE b_mem_trace_add_comment ( p_node, &BLib_mem_info, DELETE_BLIST_NODE); #endif // BLIB_MEM_TRACE b_free (p_node); } }
La sortie de mon traçage :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 DECLSPEC void b_list_free (BList * p_list) { if (p_list) { BList * p_first = b_list_first (p_list); while (p_first) { b_list_remove_node (p_first, p_first); p_first = b_list_next (p_first); } #ifdef BLIB_MEM_TRACE b_mem_trace_add_comment ( p_list, &BLib_mem_info, DELETE_BLIST); #endif // BLIB_MEM_TRACE } }
==== Creating new BList at: 0x0 ====
>> malloc ptr at: 0x8410a0
--- Adding BList node at: 0x8410a0
>> malloc ptr at: 0x8410b8
--- Adding BList node at: 0x8410b8
>> malloc ptr at: 0x8410d0
--- Adding BList node at: 0x8410d0
>> malloc ptr at: 0x8410e8
--- Adding BList node at: 0x8410e8
>> malloc ptr at: 0x841100
--- Adding BList node at: 0x841100
>> malloc ptr at: 0x841118
--- Adding BList node at: 0x841118
>> malloc ptr at: 0x841130
--- Adding BList node at: 0x841130
>> malloc ptr at: 0x841148
--- Adding BList node at: 0x841148
>> malloc ptr at: 0x841160
--- Adding BList node at: 0x841160
--- Deleting BList node at: 0x8410a0
>> free ptr at: 0x8410a0
--- Deleting BList node at: 0x841040
>> free ptr at: 0x841040
==== Deleting BList at: 0x841160 ====
Pour moi tout est bon dans le code donc un oeil neuf me fera le plus grand bien
![]()
Partager