SnapmaticPicture: fix IO memleak
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/push Build is failing
				
			This commit is contained in:
		
							parent
							
								
									186df05cea
								
							
						
					
					
						commit
						18083a3b0f
					
				
					 3 changed files with 11 additions and 2 deletions
				
			
		|  | @ -401,6 +401,12 @@ void RagePhoto::setFilePath(const QString &filePath) | |||
|     p_inputMode = 1; | ||||
| } | ||||
| 
 | ||||
| void RagePhoto::setIODevice(QIODevice *ioDevice) | ||||
| { | ||||
|     p_ioDevice = ioDevice; | ||||
|     p_inputMode = 2; | ||||
| } | ||||
| 
 | ||||
| bool RagePhoto::setJsonData(const QByteArray &data) | ||||
| { | ||||
|     QJsonDocument t_jsonDocument = QJsonDocument::fromJson(data); | ||||
|  |  | |||
|  | @ -42,13 +42,14 @@ public: | |||
|     }; | ||||
|     explicit RagePhoto(const QByteArray &data); | ||||
|     explicit RagePhoto(const QString &filePath = QString()); | ||||
|     explicit RagePhoto(QIODevice *device); | ||||
|     explicit RagePhoto(QIODevice *ioDevice); | ||||
|     bool isLoaded(); | ||||
|     bool load(); | ||||
|     void clear(); | ||||
|     void setDescription(const QString &description); | ||||
|     void setFileData(const QByteArray &data); | ||||
|     void setFilePath(const QString &filePath); | ||||
|     void setIODevice(QIODevice *ioDevice); | ||||
|     bool setJsonData(const QByteArray &data); | ||||
|     bool setPhotoData(const QByteArray &data); | ||||
|     bool setPhotoData(const char *data, int size); | ||||
|  |  | |||
|  | @ -50,7 +50,6 @@ | |||
| SnapmaticPicture::SnapmaticPicture(const QString &fileName, QObject *parent) : QObject(parent), picFilePath(fileName) | ||||
| { | ||||
|     reset(); | ||||
|     ragePhoto.setFilePath(fileName); | ||||
| } | ||||
| 
 | ||||
| SnapmaticPicture::~SnapmaticPicture() | ||||
|  | @ -93,7 +92,10 @@ bool SnapmaticPicture::preloadFile() | |||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     ragePhoto.setIODevice(picFile); | ||||
|     bool ok = ragePhoto.load(); | ||||
|     picFile->close(); | ||||
|     delete picFile; | ||||
|     if (!ok) | ||||
|         return false; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue