Possibly fix a crash in image loader.
This commit is contained in:
		
							parent
							
								
									310c68a744
								
							
						
					
					
						commit
						f59e824ec1
					
				
					 2 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -45,6 +45,13 @@ ImagePtr Create(const GeoPointLocation &location);
 | 
			
		|||
 | 
			
		||||
class Source {
 | 
			
		||||
public:
 | 
			
		||||
	Source() = default;
 | 
			
		||||
	Source(const Source &other) = delete;
 | 
			
		||||
	Source(Source &&other) = delete;
 | 
			
		||||
	Source &operator=(const Source &other) = delete;
 | 
			
		||||
	Source &operator=(Source &&other) = delete;
 | 
			
		||||
	virtual ~Source() = default;
 | 
			
		||||
 | 
			
		||||
	virtual void load(
 | 
			
		||||
		Data::FileOrigin origin,
 | 
			
		||||
		bool loadFirst,
 | 
			
		||||
| 
						 | 
				
			
			@ -83,8 +90,6 @@ public:
 | 
			
		|||
 | 
			
		||||
	virtual QByteArray bytesForCache() = 0;
 | 
			
		||||
 | 
			
		||||
	virtual ~Source() = default;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Images
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -325,6 +325,8 @@ void RemoteSource::loadLocal() {
 | 
			
		|||
void RemoteSource::setImageBytes(const QByteArray &bytes) {
 | 
			
		||||
	if (bytes.isEmpty()) {
 | 
			
		||||
		return;
 | 
			
		||||
	} else if (loaderValid()) {
 | 
			
		||||
		unload();
 | 
			
		||||
	}
 | 
			
		||||
	_loader = createLoader({}, LoadFromLocalOnly, true);
 | 
			
		||||
	_loader->finishWithBytes(bytes);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue