[virt-tools-list] [PATCH 1/2] Don't freeze property notifications when adding new displays

Marc-André Lureau marcandre.lureau at gmail.com
Wed Oct 9 20:47:45 UTC 2013


On Wed, Oct 9, 2013 at 10:09 PM, Jonathon Jongsma <jjongsma at redhat.com> wrote:
> Freezing property notifications prevents VirtViewerDisplaySpice from
> synchronizing its fullscreen/auto-resize state with the base class until after
> the notifications are thawed.  During the time that notifications were frozen,
> an allocation happens. The action we take on an allocation event depends on the
> current state of the auto_resize variable, so this can result in an unwanted
> resize.
> ---

Originally, the freeze/thaw was precisely to avoid extra transient
state handlers.

I don't know what a "less fragile" code for all this would look like
(tests would be something ;), but I would tend to lean on code that
wouldn't depend on the order of events, but just on current state
(ideally).

Since it's supposed to be a simple optimization, and it should work
regardless it is there or not, ack.

Have you thought about setting the fullscreen/auto_resize state
somehow at creation time, or using direct setter (not gobject
properties)

>  src/virt-viewer-session-spice.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
> index d9b4f88..b42d48e 100644
> --- a/src/virt-viewer-session-spice.c
> +++ b/src/virt-viewer-session-spice.c
> @@ -629,7 +629,6 @@ virt_viewer_session_spice_display_monitors(SpiceChannel *channel,
>              g_ptr_array_index(displays, i) = g_object_ref(display);
>          }
>
> -        g_object_freeze_notify(G_OBJECT(display));
>          virt_viewer_session_add_display(VIRT_VIEWER_SESSION(self),
>                                          VIRT_VIEWER_DISPLAY(display));
>      }
> @@ -647,9 +646,6 @@ virt_viewer_session_spice_display_monitors(SpiceChannel *channel,
>                                               monitor->width, monitor->height);
>      }
>
> -    for (i = 0; i < monitors_max; i++)
> -        g_object_thaw_notify(g_ptr_array_index(displays, i));
> -
>      g_clear_pointer(&monitors, g_array_unref);
>
>  }
> --
> 1.8.3.1
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list



-- 
Marc-André Lureau




More information about the virt-tools-list mailing list