mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Fix crash when cancelling a trip edit
We were comparing the wrong data and freeing things that shouldn't be freed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									413c276258
								
							
						
					
					
						commit
						3ef490fe11
					
				
					 1 changed files with 14 additions and 8 deletions
				
			
		|  | @ -843,14 +843,20 @@ void MainTab::rejectChanges() | |||
| 		} | ||||
| 	} | ||||
| 	// now let's avoid memory leaks
 | ||||
| 	struct dive *cd = current_dive; | ||||
| 	FREE_IF_DIFFERENT(tag_list); | ||||
| 	FREE_IF_DIFFERENT(location); | ||||
| 	FREE_IF_DIFFERENT(buddy); | ||||
| 	FREE_IF_DIFFERENT(divemaster); | ||||
| 	FREE_IF_DIFFERENT(notes); | ||||
| 	FREE_IF_DIFFERENT(suit); | ||||
| 
 | ||||
| 	if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) { | ||||
| 		if (editedDive.location != current_dive->divetrip->location) | ||||
| 			free(editedDive.location); | ||||
| 		if (editedDive.notes != current_dive->divetrip->notes) | ||||
| 			free(editedDive.notes); | ||||
| 	} else { | ||||
| 		struct dive *cd = current_dive; | ||||
| 		FREE_IF_DIFFERENT(tag_list); | ||||
| 		FREE_IF_DIFFERENT(location); | ||||
| 		FREE_IF_DIFFERENT(buddy); | ||||
| 		FREE_IF_DIFFERENT(divemaster); | ||||
| 		FREE_IF_DIFFERENT(notes); | ||||
| 		FREE_IF_DIFFERENT(suit); | ||||
| 	} | ||||
| 	hideMessage(); | ||||
| 	MainWindow::instance()->dive_list()->setEnabled(true); | ||||
| 	ui.dateEdit->setEnabled(true); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue