Don't trigger worker-thread cleanup when destruction has already started
Note how we're currently skipping all main-thread cleanup when document destruction has started, but for some reason we're still dispatching the "Cleanup" message. This seems like a simple oversight, since destruction will already invoke the `BasePdfManager.cleanup` method (on the worker-thread) to fully clear-out all caches.
This commit is contained in:
		
							parent
							
								
									9f5fd075e7
								
							
						
					
					
						commit
						a576ea216f
					
				@ -2997,11 +2997,11 @@ class WorkerTransport {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async startCleanup(keepLoadedFonts = false) {
 | 
					  async startCleanup(keepLoadedFonts = false) {
 | 
				
			||||||
    await this.messageHandler.sendWithPromise("Cleanup", null);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (this.destroyed) {
 | 
					    if (this.destroyed) {
 | 
				
			||||||
      return; // No need to manually clean-up when destruction has started.
 | 
					      return; // No need to manually clean-up when destruction has started.
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    await this.messageHandler.sendWithPromise("Cleanup", null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (const page of this.#pageCache.values()) {
 | 
					    for (const page of this.#pageCache.values()) {
 | 
				
			||||||
      const cleanupSuccessful = page.cleanup();
 | 
					      const cleanupSuccessful = page.cleanup();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user