xfree86: handle missing Screen lines in the ServerLayout #16301
If no Screen is specified in the ServerLayout section, either take the first one from the config file or autogenerate a default screen. X.Org Bug 16301 <http://bugs.freedesktop.org/show_bug.cgi?id=16301>
This commit is contained in:
		
							parent
							
								
									6674b87a7d
								
							
						
					
					
						commit
						fe5cf7cb00
					
				| 
						 | 
				
			
			@ -1608,10 +1608,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
 | 
			
		|||
        count++;
 | 
			
		||||
        adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
    ErrorF("Found %d screens in the layout section %s",
 | 
			
		||||
           count, conf_layout->lay_identifier);
 | 
			
		||||
#endif
 | 
			
		||||
    if (!count) /* alloc enough storage even if no screen is specified */
 | 
			
		||||
        count = 1;
 | 
			
		||||
 | 
			
		||||
    slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec));
 | 
			
		||||
    slp[count].screen = NULL;
 | 
			
		||||
    /*
 | 
			
		||||
| 
						 | 
				
			
			@ -1666,6 +1670,20 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
 | 
			
		|||
        adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* No screen was specified in the layout. take the first one from the
 | 
			
		||||
     * config file, or - if it is NULL - configScreen autogenerates one for
 | 
			
		||||
     * us */
 | 
			
		||||
    if (!count)
 | 
			
		||||
    {
 | 
			
		||||
        slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
 | 
			
		||||
	if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst,
 | 
			
		||||
                          0, X_CONFIG)) {
 | 
			
		||||
	    xfree(slp[0].screen);
 | 
			
		||||
	    xfree(slp);
 | 
			
		||||
	    return FALSE;
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* XXX Need to tie down the upper left screen. */
 | 
			
		||||
 | 
			
		||||
    /* Fill in the refscreen and top/bottom/left/right values */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue