Add explicit disposed check to async bitmap load
This commit is contained in:
		
							parent
							
								
									f9c9cb5bca
								
							
						
					
					
						commit
						bbe9976740
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -63,12 +63,14 @@
 | 
				
			||||||
void reloadBitmap(void * arg) {
 | 
					void reloadBitmap(void * arg) {
 | 
				
			||||||
	emscripten_fetch_t * fetch = (emscripten_fetch_t *) arg;
 | 
						emscripten_fetch_t * fetch = (emscripten_fetch_t *) arg;
 | 
				
			||||||
	try {
 | 
						try {
 | 
				
			||||||
		SDL_Surface * imgSurf = IMG_LoadTyped_RW(SDL_RWFromConstMem(fetch->data, fetch->numBytes), 1, "");
 | 
					 | 
				
			||||||
		Bitmap * bitmap = ((Bitmap*)fetch->userData);
 | 
							Bitmap * bitmap = ((Bitmap*)fetch->userData);
 | 
				
			||||||
 | 
							if (!bitmap->isDisposed()) {
 | 
				
			||||||
 | 
								SDL_Surface * imgSurf = IMG_LoadTyped_RW(SDL_RWFromConstMem(fetch->data, fetch->numBytes), 1, "");
 | 
				
			||||||
			bitmap->fromSurf(imgSurf, fetch->url);
 | 
								bitmap->fromSurf(imgSurf, fetch->url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (bitmap->reloadCallback)
 | 
								if (bitmap->reloadCallback)
 | 
				
			||||||
				bitmap->reloadCallback(bitmap->reloadCallbackData);
 | 
									bitmap->reloadCallback(bitmap->reloadCallbackData);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} catch (const Exception &e) {}
 | 
						} catch (const Exception &e) {}
 | 
				
			||||||
	emscripten_fetch_close(fetch);
 | 
						emscripten_fetch_close(fetch);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue