spicevmc: Do not call destroy while disconnecting

"RedChannelClient::on_disconnect", which for SpiceVMC is bound to
"spicevmc_red_channel_client_on_disconnect", is called while the
RedChannel object is disconnecting. More precisely is called after
the object has been removed from RedChannel causing
"red_channel_client_is_connected" to be false.
Calling "red_channel_client_destroy" this will lead
to a no-op as function will set "destroying" and call
"red_channel_client_disconnect" which will just exit finding
"red_channel_client_is_connected" false.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
Frediano Ziglio 2020-03-02 02:19:37 +00:00
parent c5127b9d0e
commit 53c989a686

View File

@ -437,11 +437,6 @@ static void spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc)
}
}
/* Don't destroy the rcc if it is already being destroyed, as then
red_client_destroy/red_channel_client_destroy will already do this! */
if (!red_channel_client_is_destroying(rcc))
red_channel_client_destroy(rcc);
channel->rcc = NULL;
sif = spice_char_device_get_interface(channel->chardev_sin);
if (sif->state) {