On 27/10/25 16:10, [email protected] wrote:
From: Marc-André Lureau <[email protected]>

QOM-ification continues.

Signed-off-by: Marc-André Lureau <[email protected]>
---
  audio/audio_int.h |  1 +
  audio/audio.c     | 12 ++++++++----
  2 files changed, 9 insertions(+), 4 deletions(-)


diff --git a/audio/audio.c b/audio/audio.c
index 155809dee7..4c3c3fd52f 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1622,6 +1622,9 @@ static void audio_state_init(Object *obj)
      QLIST_INIT(&s->hw_head_in);
      QLIST_INIT(&s->cap_head);
      s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s);
+
+    s->vmse = qemu_add_vm_change_state_handler(audio_vm_change_state_handler, 
s);
+    assert(s->vmse != NULL);
  }
static void audio_state_finalize(Object *obj)
@@ -1671,6 +1674,11 @@ static void audio_state_finalize(Object *obj)
          timer_free(s->ts);
          s->ts = NULL;
      }
+
+    if (s->vmse) {

Already asserted as non-NULL?

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>

+        qemu_del_vm_change_state_handler(s->vmse);
+        s->vmse = NULL;
+    }
  }


Reply via email to