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 {
 | 
					class Source {
 | 
				
			||||||
public:
 | 
					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(
 | 
						virtual void load(
 | 
				
			||||||
		Data::FileOrigin origin,
 | 
							Data::FileOrigin origin,
 | 
				
			||||||
		bool loadFirst,
 | 
							bool loadFirst,
 | 
				
			||||||
| 
						 | 
					@ -83,8 +90,6 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	virtual QByteArray bytesForCache() = 0;
 | 
						virtual QByteArray bytesForCache() = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	virtual ~Source() = default;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace Images
 | 
					} // namespace Images
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -325,6 +325,8 @@ void RemoteSource::loadLocal() {
 | 
				
			||||||
void RemoteSource::setImageBytes(const QByteArray &bytes) {
 | 
					void RemoteSource::setImageBytes(const QByteArray &bytes) {
 | 
				
			||||||
	if (bytes.isEmpty()) {
 | 
						if (bytes.isEmpty()) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
						} else if (loaderValid()) {
 | 
				
			||||||
 | 
							unload();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_loader = createLoader({}, LoadFromLocalOnly, true);
 | 
						_loader = createLoader({}, LoadFromLocalOnly, true);
 | 
				
			||||||
	_loader->finishWithBytes(bytes);
 | 
						_loader->finishWithBytes(bytes);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue