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

Yonit Halperin yhalperi at redhat.com
Thu May 17 05:09:17 PDT 2012


On 05/17/2012 02:11 PM, Marc-André Lureau wrote:
> 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);
> }
>
>
Will do the second option, thanks.



More information about the Spice-devel mailing list