diff mbox

[06/21] vl: add a tmp pointer so that a handler can delete the entry to which it belongs.

Message ID 1290665220-26478-7-git-send-email-tamura.yoshiaki@lab.ntt.co.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Yoshiaki Tamura Nov. 25, 2010, 6:06 a.m. UTC
None
diff mbox

Patch

diff --git a/vl.c b/vl.c
index 805e11f..6b6aec0 100644
--- a/vl.c
+++ b/vl.c
@@ -1073,11 +1073,12 @@  void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
 
 void vm_state_notify(int running, int reason)
 {
-    VMChangeStateEntry *e;
+    VMChangeStateEntry *e, *ne;
 
     trace_vm_state_notify(running, reason);
 
-    for (e = vm_change_state_head.lh_first; e; e = e->entries.le_next) {
+    for (e = vm_change_state_head.lh_first; e; e = ne) {
+        ne = e->entries.le_next;
         e->cb(e->opaque, running, reason);
     }
 }