[Spice-devel] [spice-gtk] Fix using NULL main channel reference

Javier Celaya javier.celaya at flexvdi.com
Mon Sep 24 06:25:48 UTC 2018


Hi
El mié, 19-09-2018 a las 15:30 +0200, Victor Toso escribió:
> Hi,
> On Mon, Aug 13, 2018 at 01:44:37PM +0200, Javier Celaya wrote:
> Hi, sorry for the late response, I was on holidaysEl mar, 24-07-2018
> a las 17:58 +0200, Marc-André Lureau escribió:
> On Mon, Jul 16, 2018 at 6:45 PM, Javier Celaya<javier.celaya at flexvdi.
> com> wrote:The main channel reference d->main of SpiceWidget
> isinitialized onconstruction. However, it is used a couple of
> timesbefore that momentwhile setting the default values of
> someproperties, like resize-guest.This results in some annoying
> criticallog messages. This commit makessure that d->main is not used
> in suchsituations if it is NULL.Could you provide a reproducer of
> such warnings? I don't rememberseeing one.
> I see them each time I connect to a Spice session with spicy.
> Followme:- These warnings appear because d->main is NULL.- d->main is
> set in spice-widget.c:channel_new function, whenthe new channel is
> the main channel.- channel_new is called from
> spice_display_constructed with thelist of channels that already
> exist; obviously, the mainchannel is one of them.- There are
> SpiceDisplay properties that are set duringconstruction, before
> spice_display_constructed is called, thattrigger the code I am fixing
> with this patch.
> Makes sense.
> For instance, after setting "resize-guest" to its default valueTRUE,
> update_ready is called.So I do not see how you are notseeing these
> warnings. It does not seem to be a race condition,it happens always.
> resize-guest-enable's default is FALSE
> sospice_main_channel_update_display_enabled() would not be calledand
> not sure how you are manage to trigger it?

My bad. We use a slightly modified version of spice-gtk for the flexVDI
clients, and I did not remember that one of the changes is that resize-
guest is set to TRUE by default. Maybe that's the reason we see the
warning and you don't.
> I've added a g_warn_if_fail(d->main != NULL); and indeed thed->main
> can be null at that point, so I'm keen to take the patchalthough a
> different solution might be better...
> Could you send a v2 with d->main check against NULL as
> Fredianomentioned and add the critical you see on commit log
> forcompleteness ?
> Sorry for delay, so many patches!Victor

Never mind! Patch is on its way
> --- src/spice-widget.c | 4 ++-- 1 file changed, 2 insertions(+),
> 2deletions(-)diff --git a/src/spice-widget.c b/src/spice-
> widget.cindex72f5334..5187b0c 100644--- a/src/spice-widget.c+++
> b/src/spice-widget.c@@ -255,7 +255,7 @@ static void
> update_ready(SpiceDisplay*display)      * state here. If 'resize-
> guest' is false, we canassume that the      * application will manage
> the state of thedisplays.      */-    if (d->resize_guest_enable)
> {+    if (d-
> resize_guest_enable && d-
> >main){         spice_main_channel_update_display_enabled(d-
> >main,get_display_id(display), ready, TRUE);     }@@ -1247,7 +1247,7
> @@ static void recalc_geometry(GtkWidget*widget)                   d-
> >area.width, d-
> area.height,                   d->ww, d->wh, zoom);-    if (d-
> >resize_guest_enable)+    if (d->resize_guest_enable && d-
> main)         spice_main_channel_update_display(d-
> >main,get_display_id(display),                                       
>     d-
> area.x, d->area.y, d->ww / zoom, d->wh / zoom, TRUE);It looks like
> this may not give you the desired display size.
> Again, the warning happens when the property "scaling" is set
> duringSpiceDisplay construction, which calls scaling_update. You
> cannot callspice_main_channel_update_display with d->main == NULL, so
> this checkis harmless.
>  }--2.17.0_______________________________________________Spice-devel
> mailinglistSpice-devel at lists.freedesktop.orghttps://lists.freedesktop
> .org/mailman/listinfo/spice-devel
> 
> 
> -- 
> 
> 
> 
>  
> 
> 
> 
> 
>                                                             Javier
> Celaya Alastrué                     Chief Technology
> Officer                                       javier.celaya at flexvdi.c
> om                                  +34696969959                     
>     j_celaya                                  Legal Information and
> Privacy Policy                                            Política de
> confidencialidad            Este mensaje y los ficheros anexos son
> confidenciales dirigiéndose exclusivamente al destinatario mencionado
> en el encabezamiento. Si usted ha recibido este correo por error,
> tenga la amabilidad de eliminarlo de su sistema y no divulgar el
> contenido a terceros. Los datos personales facilitados por usted o
> por terceros serán tratados por FLEXIBLE SOFTWARE SOLUTIONS S.L.U.
> con la finalidad de gestionar y mantener los contactos y relaciones
> que se produzcan como consecuencia de la relación que mantiene con
> FLEXIBLE SOFTWARE SOLUTIONS S.L.U. Normalmente, la base jurídica que
> legitima este tratamiento, será su consentimiento, el interés
> legítimo o la necesidad para gestionar una relación contractual o
> similar. El plazo de conservación de sus datos vendrá determinado por
> la relación que mantiene con nosotros. Para más información al
> respecto, o para ejercer sus derechos de acceso, rectificación,
> supresión, oposición, limitación o portabilidad, dirija una
> comunicación por escrito a FLEXIBLE SOFTWARE SOLUTIONS S.L.U: Avenida
> de Ranillas 1D, Planta 3, Oficina 3G, Zaragoza o al correo
> electrónico pdo at flexvdi.com. En caso de considerar vulnerado su
> derecho a la protección de datos personales, podrá interponer una
> reclamación ante la Agencia Española de Protección de Datos
> (www.agpd.es).             
> _______________________________________________Spice-devel mailing
> listSpice-devel at lists.freedesktop.orghttps://lists.freedesktop.org/ma
> ilman/listinfo/spice-devel
> 
-- 




 





              
              
          
          
            Javier Celaya Alastrué
          
           Chief Technology Officer
      
      
        
           
        javier.celaya at flexvdi.com
        
        
          
        +34696969959 
      
          
        j_celaya
        
        
          
        Legal Information and Privacy Policy
          
      
    
    
        
            Política de confidencialidad
            Este mensaje y los ficheros anexos son confidenciales dirigiéndose exclusivamente al destinatario mencionado en el encabezamiento. Si usted ha recibido este correo por error, tenga la amabilidad de eliminarlo de su sistema y no divulgar el contenido a terceros. Los datos personales facilitados por usted o por terceros serán tratados por FLEXIBLE SOFTWARE SOLUTIONS S.L.U. con la finalidad de gestionar y mantener los contactos y relaciones que se produzcan como consecuencia de la relación que mantiene con FLEXIBLE SOFTWARE SOLUTIONS S.L.U. Normalmente, la base jurídica que legitima este tratamiento, será su consentimiento, el interés legítimo o la necesidad para gestionar una relación contractual o similar. El plazo de conservación de sus datos vendrá determinado por la relación que mantiene con nosotros. Para más información al respecto, o para ejercer sus derechos de acceso, rectificación, supresión, oposición, limitación o portabilidad, dirija una comunicación por escrito a FLEXIBLE SOFTWARE SOLUTIONS S.L.U: Avenida de Ranillas 1D, Planta 3, Oficina 3G, Zaragoza o al correo electrónico pdo at flexvdi.com. En caso de considerar vulnerado su derecho a la protección de datos personales, podrá interponer una reclamación ante la Agencia Española de Protección de Datos (www.agpd.es). 
        
    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180924/c58e25e3/attachment.html>


More information about the Spice-devel mailing list