mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	seat_set_focus_wrap: fix use-after-free when destroying last focused container
This commit is contained in:
		
							parent
							
								
									200d0360ea
								
							
						
					
					
						commit
						1fd21650d7
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
					@ -491,6 +491,9 @@ void seat_set_focus_warp(struct sway_seat *seat,
 | 
				
			||||||
			ipc_event_workspace(last_ws, container, "focus");
 | 
								ipc_event_workspace(last_ws, container, "focus");
 | 
				
			||||||
			if (!workspace_is_visible(last_ws)
 | 
								if (!workspace_is_visible(last_ws)
 | 
				
			||||||
					&& last_ws->children->length == 0) {
 | 
										&& last_ws->children->length == 0) {
 | 
				
			||||||
 | 
									if (last_ws == last_focus) {
 | 
				
			||||||
 | 
										last_focus = NULL;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				container_destroy(last_ws);
 | 
									container_destroy(last_ws);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue