dri2: Fix detection of wrong prime_id in GetScreenPrime.
Checking the iterating variable ("slave") against null can not detect if the
xorg_list_for_each_entry finished without break being invoked - slave variable
will be always non-null. This caused segfault whenever someone tried to use
DRI_PRIME with incorrect id while having at least one render offloading slave
configured.
Restructurize the GetScreenPrime to work as expected.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
			
			
This commit is contained in:
		
							parent
							
								
									c08d2b8ccb
								
							
						
					
					
						commit
						3dba171f5e
					
				|  | @ -156,12 +156,10 @@ GetScreenPrime(ScreenPtr master, int prime_id) | |||
| 
 | ||||
|         ds = DRI2GetScreen(slave); | ||||
|         if (ds->prime_id == prime_id) | ||||
|             break; | ||||
|     } | ||||
|     if (!slave) | ||||
|         return master; | ||||
|             return slave; | ||||
|     } | ||||
|     return master; | ||||
| } | ||||
| 
 | ||||
| static DRI2ScreenPtr | ||||
| DRI2GetScreenPrime(ScreenPtr master, int prime_id) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue