Add SpiceSession::disconnected signal
Previously, an application was required to determine whether a session had been disconnected by listening for the SpiceSession::channel-destroy signal for each individual channel. The Application had to keep track of whether all channels had been destroyed. An additional difficulty is that when a SpiceSession::channel-destroy signal is emitted, the channel object has not been freed yet, so any shutdown/de-allocation actions have not yet happened. This became significant since virt-viewer exits the application in response to the last 'channel-destroy' signal, which means that the channel objects are never properly freed. This is particularly problematic for the usbredir channel, which might need to disconnect USB devices asynchronously, and if the application exits before that process has completed, the USB devices may not be available on the client machine. With this patch, the SpiceSession still emits the 'channel-destroy' signal for each channel when it is disconnected. But it also internally tracks which channels have been destroyed, and waits for them to be freed. When all channels are freed, it emits an additional 'disconnected' signal. An application can be confident that all channels have been freed by this point, and the application can exit safely. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Loading
Please register or sign in to comment