mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
char: remove the right fd been watched in qemu_chr_fe_set_handlers()
We can call qemu_chr_fe_set_handlers() to add/remove fd been watched in 'context' which can be either default main context or other explicit context. But the original logic is not correct, we didn't remove the right fd because we call g_main_context_find_source_by_id(NULL, tag) which always try to find the Gsource from default context. Fix it by passing the right context to g_main_context_find_source_by_id(). Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
dfd917a9c2
commit
8487ce45f8
7 changed files with 15 additions and 15 deletions
|
@ -328,7 +328,7 @@ static void tcp_chr_free_connection(Chardev *chr)
|
|||
}
|
||||
|
||||
tcp_set_msgfds(chr, NULL, 0);
|
||||
remove_fd_in_watch(chr);
|
||||
remove_fd_in_watch(chr, NULL);
|
||||
object_unref(OBJECT(s->sioc));
|
||||
s->sioc = NULL;
|
||||
object_unref(OBJECT(s->ioc));
|
||||
|
@ -498,7 +498,7 @@ static void tcp_chr_update_read_handler(Chardev *chr,
|
|||
return;
|
||||
}
|
||||
|
||||
remove_fd_in_watch(chr);
|
||||
remove_fd_in_watch(chr, NULL);
|
||||
if (s->ioc) {
|
||||
chr->fd_in_tag = io_add_watch_poll(chr, s->ioc,
|
||||
tcp_chr_read_poll,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue