mi: don't crash on miPointerGetPosition for disabled devices
If a device is disabled, its master device is forcibly reset to NULL but unlike a floating device it doesn't have a sprite allocated. Calling miPointerGetPosition for a disabled device thus crashes. Avoid this by returning 0/0 for any device without a miPointer. This is a quick fix only, a proper fix for this issue is rather more involved. Closes #1782 Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1771>
This commit is contained in:
		
							parent
							
								
									05e54fefaf
								
							
						
					
					
						commit
						acbdd0ecdd
					
				| 
						 | 
					@ -726,8 +726,15 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
 | 
					miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    *x = MIPOINTER(pDev)->x;
 | 
					    miPointerPtr pPointer = MIPOINTER(pDev);
 | 
				
			||||||
    *y = MIPOINTER(pDev)->y;
 | 
					    if (pPointer) {
 | 
				
			||||||
 | 
					        *x = pPointer->x;
 | 
				
			||||||
 | 
					        *y = pPointer->y;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else {
 | 
				
			||||||
 | 
					        *x = 0;
 | 
				
			||||||
 | 
					        *y = 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue