[virt-tools-list] [virt-viewer 2/2] session: Don't hold VirtViewerDisplay refs on channel destroy

Christophe Fergeau cfergeau at redhat.com
Wed Nov 20 09:35:58 UTC 2013


On Tue, Nov 19, 2013 at 04:19:25PM -0500, Marc-André Lureau wrote:
> 
> 
> ----- Original Message -----
> > VirtViewerSessionSpice creates a reference-holding VirtViewerDisplay
> > array and associates it with the display SpiceChannel with
> > g_object_set_data(channel, "virt-viewer-displays").
> > 
> > When virt_viewer_session_spice_channel_destroy() is called and the display
> > channel is being destroyed, we should ensure these VirtViewerDisplay
> > references are dropped or the displays could outlive the session.
> 
> Should't it unref when the channel is disposed?

The backtrace below triggers during spice_channel_display_dispose (frame
#31), we start disposing the display channel, the session gets destroyed,
but the VirtViewerDisplaySpice are still alive through that
SpiceChannel:virt-viewer-displays array. and then some VirtViewerDisplaySpice
code runs and tries to use the VirtViewerSession that was just disposed.
After spice_channel_display_dispose() finishes running, the gobject data
'virt-viewer-displays' will get freed, and the VirtViewerDisplay will be
disposed of (that is, if we did not crash when trying to use the session).

By setting virt-viewer-displays to NULL in this patch, we make sure the
VirtViewerDisplay are freed at the same time as the VirtViewerSessionSpice.
It makes to do it here as the 'virt-viewer-displays' data is associated
with the display channel in VirtViewerSessionSpice.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20131120/a7493fd0/attachment.sig>


More information about the virt-tools-list mailing list