[virt-tools-list] [PATCH v2 07/16] session: skip monitor changes if there is no sized monitors

Victor Toso victortoso at redhat.com
Thu Dec 20 16:55:31 UTC 2018


Hi,

On Thu, Dec 20, 2018 at 05:25:09PM +0100, Victor Toso wrote:
> Hi,
> 
> On Wed, Sep 26, 2018 at 07:26:30PM +0400, marcandre.lureau at redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau at redhat.com>
> > 
> > spice-gtk discards configurations without any sized monitors.
> > 
> > Also shuts extra warnings when shifting the monitors.
> > 
> > Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> > ---
> >  src/virt-viewer-session.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
> > index 5bac3d9..cd1f037 100644
> > --- a/src/virt-viewer-session.c
> > +++ b/src/virt-viewer-session.c
> > @@ -406,6 +406,7 @@ virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession* self,
> >      gboolean all_fullscreen = TRUE;
> >      /* GHashTable<gint, GdkRectangle*> */
> >      GHashTable *monitors;
> > +    gint n_sized_monitors = 0;
> >      GList *l;
> >  
> >      klass = VIRT_VIEWER_SESSION_GET_CLASS(self);
> > @@ -421,6 +422,8 @@ virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession* self,
> >  
> >          g_object_get(d, "nth-display", &nth, NULL);
> >          virt_viewer_display_get_preferred_monitor_geometry(d, rect);
> > +        if (rect->width > 0 && rect->height > 0)
> > +            n_sized_monitors++;
> >  
> >          if (virt_viewer_display_get_enabled(d) &&
> >              !virt_viewer_display_get_fullscreen(d))
> > @@ -428,6 +431,9 @@ virt_viewer_session_on_monitor_geometry_changed(VirtViewerSession* self,
> >          g_hash_table_insert(monitors, GINT_TO_POINTER(nth), rect);
> >      }
> >  
> > +    if (!n_sized_monitors)
> > +        return;
> > +

Actually, you are leaking GHashTable *monitors with this return.

Perhaps this and previous one are not needed at all as mentioned
with in the patch 11/16... but both this one and previous one are
sane, enough to have I think, just need to fix this leak :)

> As non boolean, I'd go with full n_sized_monitors == 0, not sure
> what is preferred in virt-viewer code base tbh.
> 
> Either way,
> Acked-by: Victor Toso <victortoso at redhat.com>
> 
> >      if (!all_fullscreen)
> >          virt_viewer_align_monitors_linear(monitors);
> >  
> > -- 
> > 2.19.0.271.gfe8321ec05
> > 



> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20181220/2a88c5b0/attachment.sig>


More information about the virt-tools-list mailing list