Ensure that releaseGl() is called if prepapreGl throws
Without this logic, we might have resources created within prepareGl() leaking, since they will never be released. PiperOrigin-RevId: 583491569
This commit is contained in:
		
							parent
							
								
									d29ea119ff
								
							
						
					
					
						commit
						42d42a5ea1
					
				| 
						 | 
					@ -128,6 +128,10 @@ public class GlThread extends Thread {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      prepareGl();
 | 
					      prepareGl();
 | 
				
			||||||
      startedSuccessfully = true;
 | 
					      startedSuccessfully = true;
 | 
				
			||||||
 | 
					    } catch (RuntimeException e) {
 | 
				
			||||||
 | 
					      releaseGl();
 | 
				
			||||||
 | 
					      eglManager.release();
 | 
				
			||||||
 | 
					      throw e;
 | 
				
			||||||
    } finally {
 | 
					    } finally {
 | 
				
			||||||
      // Always stop waitUntilReady here, even if we got an exception.
 | 
					      // Always stop waitUntilReady here, even if we got an exception.
 | 
				
			||||||
      // Otherwise the main thread may be stuck waiting.
 | 
					      // Otherwise the main thread may be stuck waiting.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user