Skip to content

Commit 02b8aee

Browse files
committed
Merge remote-tracking branch 'remotes/kraxel/tags/fixes-20210810-pull-request' into staging
fixes for gtk, sdl and audio live migration. # gpg: Signature made Tue 10 Aug 2021 13:18:30 BST # gpg: using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>" [full] # gpg: aka "Gerd Hoffmann <[email protected]>" [full] # gpg: aka "Gerd Hoffmann (private) <[email protected]>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/fixes-20210810-pull-request: ui/sdl2: Check return value from g_setenv() audio: Never send migration section ui/gtk: retry sending VTE console input Signed-off-by: Peter Maydell <[email protected]>
2 parents 1f3afa5 + 6ff5b5d commit 02b8aee

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

audio/audio.c

+10
Original file line numberDiff line numberDiff line change
@@ -1622,10 +1622,20 @@ void audio_cleanup(void)
16221622
}
16231623
}
16241624

1625+
static bool vmstate_audio_needed(void *opaque)
1626+
{
1627+
/*
1628+
* Never needed, this vmstate only exists in case
1629+
* an old qemu sends it to us.
1630+
*/
1631+
return false;
1632+
}
1633+
16251634
static const VMStateDescription vmstate_audio = {
16261635
.name = "audio",
16271636
.version_id = 1,
16281637
.minimum_version_id = 1,
1638+
.needed = vmstate_audio_needed,
16291639
.fields = (VMStateField[]) {
16301640
VMSTATE_END_OF_LIST()
16311641
}

ui/gtk.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -1646,16 +1646,14 @@ static void gd_vc_send_chars(VirtualConsole *vc)
16461646

16471647
len = qemu_chr_be_can_write(vc->vte.chr);
16481648
avail = fifo8_num_used(&vc->vte.out_fifo);
1649-
if (len > avail) {
1650-
len = avail;
1651-
}
1652-
while (len > 0) {
1649+
while (len > 0 && avail > 0) {
16531650
const uint8_t *buf;
16541651
uint32_t size;
16551652

1656-
buf = fifo8_pop_buf(&vc->vte.out_fifo, len, &size);
1653+
buf = fifo8_pop_buf(&vc->vte.out_fifo, MIN(len, avail), &size);
16571654
qemu_chr_be_write(vc->vte.chr, (uint8_t *)buf, size);
1658-
len -= size;
1655+
len = qemu_chr_be_can_write(vc->vte.chr);
1656+
avail -= size;
16591657
}
16601658
}
16611659

ui/sdl2.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,10 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
817817
* This is a bit hackish but saves us from bigger problem.
818818
* Maybe it's a good idea to fix this in SDL instead.
819819
*/
820-
g_setenv("SDL_VIDEODRIVER", "x11", 0);
820+
if (!g_setenv("SDL_VIDEODRIVER", "x11", 0)) {
821+
fprintf(stderr, "Could not set SDL_VIDEODRIVER environment variable\n");
822+
exit(1);
823+
}
821824
#endif
822825

823826
if (SDL_Init(SDL_INIT_VIDEO)) {

0 commit comments

Comments
 (0)