[Spice-devel] [PATCH spice-gtk 2/5] main channel: reseting channel caps

Marc-André Lureau marcandre.lureau at gmail.com
Thu May 17 04:11:06 PDT 2012


On Thu, May 17, 2012 at 11:20 AM, Yonit Halperin <yhalperi at redhat.com> wrote:
> +static void spice_main_channel_reset_capabilties(SpiceChannel *channel)
> +{
> +    spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE);
> +    spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_MAIN_CAP_NAME_AND_UUID);
> +}
> +

It should chain up to call the default/overriden
spice_channel_reset_capabilities().

I guess calling parent_class->reset_capabilties(channel); first.

Otherwise, since we may want to clear in all cases:

replace channel_reset():
{
-    SPICE_CHANNEL_GET_CLASS(channel)->channel_reset_capabilities(channel);
+   spice_channel_reset_capabilities(channel)
}

And call the virtual method in spice_channel_reset_capabilities()

static void spice_channel_reset_capabilities(SpiceChannel *channel)
{

    SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel);
    g_array_set_size(c->caps, 0);
+  if (SPICE_CHANNEL_GET_CLASS(channel)->channel_reset_capabilities)
+   SPICE_CHANNEL_GET_CLASS(channel)->channel_reset_capabilities(channel);
}


-- 
Marc-André Lureau


More information about the Spice-devel mailing list