mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-25 04:30:02 +00:00
Monitor patches for 2016-08-08
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJXqHoKAAoJEDhwtADrkYZTr30P/2tQWQuqKYkfFweORpAFyPpR b8wbK9kb7OHRRIwvQGAgE4/j+erBCdXlOnbTABQY1jEmQW7ZZHdDgInxL6mdy5EH wtCMXiy8XBeAOlgmh+/mLesoGWmuuOlEjiKo2l6oPKbWjTrwuun1+iTxePdOSNXf b2bFUIWEW9HBi+7uMdlVC+slKdKRC41qCj6YZzuR0dS1BS121DQMZmEguzXfS+tP 6uWBC8nnagUAF6SBt4j6stYvGNS8hF+48erzMPqjOAFKXA4CXoXTMwYt5ryn5AVc mAE/7pI3G3TFk7JVyI8YKm7+kNRFAyAF0VmnM8BlFMieDx6yS9c6Dig/WXOFCpPg mAXn9fka8ZNeCLv8zaGAowjTBi2EMe/77waqMQXI0QwyiDKqvF9ZOzuaR/fkAFhb x/HqwispfvO9A8rbP/U3qKHv0O2UVNMLikrKsh0Sb/fz2tKtnLK8Djx6Q7KtBM17 TZynTJ7Z3ZHLgur7SHMcyE1l8yooon2oLJV3UaqDB8kO+4/hnigcKYkVDv7XK9w3 KQi8lW9DymuQ7ebulxi+DaP4PjAqvqszbjkUiT9IC4rhTzK/06Zkm8e9ILbB9qEK txghf8QtLJKi6pWZD4bP5s4V4r0+SBhPB/RGrXKkQ4x+FZNtv8ZHTVTnmAueoMY8 xidCTngFpeuC0aNmBZPn =ozdw -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2016-08-08' into staging Monitor patches for 2016-08-08 # gpg: Signature made Mon 08 Aug 2016 13:24:42 BST # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-monitor-2016-08-08: audio: clean up before monitor clean up monitor: fix crash when leaving qemu with spice audio Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
4977bb09dd
@ -1739,13 +1739,21 @@ static void audio_vm_change_state_handler (void *opaque, int running,
|
||||
audio_reset_timer (s);
|
||||
}
|
||||
|
||||
static void audio_atexit (void)
|
||||
static bool is_cleaning_up;
|
||||
|
||||
bool audio_is_cleaning_up(void)
|
||||
{
|
||||
return is_cleaning_up;
|
||||
}
|
||||
|
||||
void audio_cleanup(void)
|
||||
{
|
||||
AudioState *s = &glob_audio_state;
|
||||
HWVoiceOut *hwo = NULL;
|
||||
HWVoiceIn *hwi = NULL;
|
||||
HWVoiceOut *hwo, *hwon;
|
||||
HWVoiceIn *hwi, *hwin;
|
||||
|
||||
while ((hwo = audio_pcm_hw_find_any_out (hwo))) {
|
||||
is_cleaning_up = true;
|
||||
QLIST_FOREACH_SAFE(hwo, &glob_audio_state.hw_head_out, entries, hwon) {
|
||||
SWVoiceCap *sc;
|
||||
|
||||
if (hwo->enabled) {
|
||||
@ -1761,17 +1769,20 @@ static void audio_atexit (void)
|
||||
cb->ops.destroy (cb->opaque);
|
||||
}
|
||||
}
|
||||
QLIST_REMOVE(hwo, entries);
|
||||
}
|
||||
|
||||
while ((hwi = audio_pcm_hw_find_any_in (hwi))) {
|
||||
QLIST_FOREACH_SAFE(hwi, &glob_audio_state.hw_head_in, entries, hwin) {
|
||||
if (hwi->enabled) {
|
||||
hwi->pcm_ops->ctl_in (hwi, VOICE_DISABLE);
|
||||
}
|
||||
hwi->pcm_ops->fini_in (hwi);
|
||||
QLIST_REMOVE(hwi, entries);
|
||||
}
|
||||
|
||||
if (s->drv) {
|
||||
s->drv->fini (s->drv_opaque);
|
||||
s->drv = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1799,7 +1810,7 @@ static void audio_init (void)
|
||||
QLIST_INIT (&s->hw_head_out);
|
||||
QLIST_INIT (&s->hw_head_in);
|
||||
QLIST_INIT (&s->cap_head);
|
||||
atexit (audio_atexit);
|
||||
atexit(audio_cleanup);
|
||||
|
||||
s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s);
|
||||
|
||||
@ -1966,8 +1977,7 @@ CaptureVoiceOut *AUD_add_capture (
|
||||
QLIST_INSERT_HEAD (&s->cap_head, cap, entries);
|
||||
QLIST_INSERT_HEAD (&cap->cb_head, cb, entries);
|
||||
|
||||
hw = NULL;
|
||||
while ((hw = audio_pcm_hw_find_any_out (hw))) {
|
||||
QLIST_FOREACH(hw, &glob_audio_state.hw_head_out, entries) {
|
||||
audio_attach_capture (hw);
|
||||
}
|
||||
return cap;
|
||||
|
@ -163,4 +163,7 @@ static inline void *advance (void *p, int incr)
|
||||
int wav_start_capture (CaptureState *s, const char *path, int freq,
|
||||
int bits, int nchannels);
|
||||
|
||||
bool audio_is_cleaning_up(void);
|
||||
void audio_cleanup(void);
|
||||
|
||||
#endif /* QEMU_AUDIO_H */
|
||||
|
@ -36,8 +36,6 @@
|
||||
#define MAC_OS_X_VERSION_10_6 1060
|
||||
#endif
|
||||
|
||||
static int isAtexit;
|
||||
|
||||
typedef struct {
|
||||
int buffer_frames;
|
||||
int nbuffers;
|
||||
@ -378,11 +376,6 @@ static inline UInt32 isPlaying (AudioDeviceID outputDeviceID)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void coreaudio_atexit (void)
|
||||
{
|
||||
isAtexit = 1;
|
||||
}
|
||||
|
||||
static int coreaudio_lock (coreaudioVoiceOut *core, const char *fn_name)
|
||||
{
|
||||
int err;
|
||||
@ -630,7 +623,7 @@ static void coreaudio_fini_out (HWVoiceOut *hw)
|
||||
int err;
|
||||
coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw;
|
||||
|
||||
if (!isAtexit) {
|
||||
if (!audio_is_cleaning_up()) {
|
||||
/* stop playback */
|
||||
if (isPlaying(core->outputDeviceID)) {
|
||||
status = AudioDeviceStop(core->outputDeviceID, core->ioprocid);
|
||||
@ -673,7 +666,7 @@ static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, ...)
|
||||
|
||||
case VOICE_DISABLE:
|
||||
/* stop playback */
|
||||
if (!isAtexit) {
|
||||
if (!audio_is_cleaning_up()) {
|
||||
if (isPlaying(core->outputDeviceID)) {
|
||||
status = AudioDeviceStop(core->outputDeviceID,
|
||||
core->ioprocid);
|
||||
@ -697,7 +690,6 @@ static void *coreaudio_audio_init (void)
|
||||
CoreaudioConf *conf = g_malloc(sizeof(CoreaudioConf));
|
||||
*conf = glob_conf;
|
||||
|
||||
atexit(coreaudio_atexit);
|
||||
return conf;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ extern Monitor *cur_mon;
|
||||
bool monitor_cur_is_qmp(void);
|
||||
|
||||
void monitor_init(CharDriverState *chr, int flags);
|
||||
void monitor_cleanup(void);
|
||||
|
||||
int monitor_suspend(Monitor *mon);
|
||||
void monitor_resume(Monitor *mon);
|
||||
|
20
monitor.c
20
monitor.c
@ -635,6 +635,13 @@ static void monitor_data_init(Monitor *mon)
|
||||
|
||||
static void monitor_data_destroy(Monitor *mon)
|
||||
{
|
||||
if (mon->chr) {
|
||||
qemu_chr_add_handlers(mon->chr, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
if (monitor_is_qmp(mon)) {
|
||||
json_message_parser_destroy(&mon->qmp.parser);
|
||||
}
|
||||
g_free(mon->rs);
|
||||
QDECREF(mon->outbuf);
|
||||
qemu_mutex_destroy(&mon->out_lock);
|
||||
}
|
||||
@ -4196,6 +4203,19 @@ void monitor_init(CharDriverState *chr, int flags)
|
||||
qemu_mutex_unlock(&monitor_lock);
|
||||
}
|
||||
|
||||
void monitor_cleanup(void)
|
||||
{
|
||||
Monitor *mon, *next;
|
||||
|
||||
qemu_mutex_lock(&monitor_lock);
|
||||
QLIST_FOREACH_SAFE(mon, &mon_list, entry, next) {
|
||||
QLIST_REMOVE(mon, entry);
|
||||
monitor_data_destroy(mon);
|
||||
g_free(mon);
|
||||
}
|
||||
qemu_mutex_unlock(&monitor_lock);
|
||||
}
|
||||
|
||||
static void bdrv_password_cb(void *opaque, const char *password,
|
||||
void *readline_opaque)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user