vl: use QLIST_FOREACH_SAFE to visit change state handlers
This lets a handler delete itself. Acked-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									fc7a5800ad
								
							
						
					
					
						commit
						9b10ac869d
					
				
							
								
								
									
										4
									
								
								vl.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								vl.c
									
									
									
									
									
								
							@ -1721,11 +1721,11 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void vm_state_notify(int running, RunState state)
 | 
					void vm_state_notify(int running, RunState state)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    VMChangeStateEntry *e;
 | 
					    VMChangeStateEntry *e, *next;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    trace_vm_state_notify(running, state);
 | 
					    trace_vm_state_notify(running, state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (e = vm_change_state_head.lh_first; e; e = e->entries.le_next) {
 | 
					    QLIST_FOREACH_SAFE(e, &vm_change_state_head, entries, next) {
 | 
				
			||||||
        e->cb(e->opaque, running, state);
 | 
					        e->cb(e->opaque, running, state);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user