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

Javier Celaya javier.celaya at flexvdi.com
Mon Aug 13 11:44:37 UTC 2018


Hi, sorry for the late response, I was on holidays
El 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 is
> initialized onconstruction. However, it is used a couple of times
> before that momentwhile setting the default values of some
> properties, like resize-guest.This results in some annoying critical
> log messages. This commit makessure that d->main is not used in such
> situations if it is NULL.
> Could you provide a reproducer of such warnings? I don't remember
> seeing one.

I see them each time I connect to a Spice session with spicy. Follow
me:- These warnings appear because d->main is NULL.- d->main is set in
spice-widget.c:channel_new function, when the new channel is the main
channel.- channel_new is called from spice_display_constructed with the
list of channels that already exist; obviously, the main channel is one
of them.- There are SpiceDisplay properties that are set during
construction, before spice_display_constructed is called, that trigger
the code I am fixing with this patch. For instance, after setting
"resize-guest" to its default value TRUE, update_ready is called.So I
do not see how you are not seeing these warnings. It does not seem to
be a race condition, it happens always.
> --- src/spice-widget.c | 4 ++-- 1 file changed, 2 insertions(+), 2
> deletions(-)
> diff --git a/src/spice-widget.c b/src/spice-widget.cindex
> 72f5334..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 can
> assume that the      * application will manage the state of the
> displays.      */-    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 during
SpiceDisplay construction, which calls scaling_update. You cannot call
spice_main_channel_update_display with d->main == NULL, so this check
is harmless.
>  }--2.17.0
> _______________________________________________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/20180813/18f22bf6/attachment-0001.html>


More information about the Spice-devel mailing list