mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Fix all leak-at-exit from singletons in Subsurface
Subsurface creates a lot of singleton instances on demand, but nothing ever deleted them. Since they are singletons, these memory allocations are technically not leaks. However, they clutter the output in valgrind and other memory analysers, hiding the real issues. The solution is to delete these items at exit. For the models and for gettextFromC, the solution is to use a QScopedPointer, which will delete its payload when it gets destroyed. For the dialogs and other widgets, we can't do that: they need to be deleted before QApplication exits, so we just set the parent in all of them to the main window. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									bd7ded8894
								
							
						
					
					
						commit
						b22f1da59e
					
				
					 12 changed files with 32 additions and 27 deletions
				
			
		|  | @ -37,7 +37,7 @@ namespace DownloadFromDcGlobal{ | |||
| 
 | ||||
| DownloadFromDCWidget *DownloadFromDCWidget::instance() | ||||
| { | ||||
| 	static DownloadFromDCWidget *dialog = new DownloadFromDCWidget(); | ||||
| 	static DownloadFromDCWidget *dialog = new DownloadFromDCWidget(mainWindow()); | ||||
| 	dialog->setAttribute(Qt::WA_QuitOnClose, false); | ||||
| 	return dialog; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue