mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Assign the uniq dive ID the moment a dive is allocated
Previously we only did this when we did fixup_dive(), but that way we can't reference dives "early" in their life cycle (e.g., right after they got downloaded). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									cae51ff0aa
								
							
						
					
					
						commit
						b36c8f07c7
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		
							
								
								
									
										4
									
								
								dive.c
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								dive.c
									
										
									
									
									
								
							| 
						 | 
					@ -221,6 +221,7 @@ struct dive *alloc_dive(void)
 | 
				
			||||||
	if (!dive)
 | 
						if (!dive)
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
	memset(dive, 0, sizeof(*dive));
 | 
						memset(dive, 0, sizeof(*dive));
 | 
				
			||||||
 | 
						dive->id = dive_getUniqID(dive);
 | 
				
			||||||
	return dive;
 | 
						return dive;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -955,6 +956,9 @@ struct dive *fixup_dive(struct dive *dive)
 | 
				
			||||||
		weightsystem_t *ws = dive->weightsystem + i;
 | 
							weightsystem_t *ws = dive->weightsystem + i;
 | 
				
			||||||
		add_weightsystem_description(ws);
 | 
							add_weightsystem_description(ws);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						/* we should always have a uniq ID as that gets assigned during alloc_dive(),
 | 
				
			||||||
 | 
						 * but we want to make sure... */
 | 
				
			||||||
 | 
						if (!dive->id)
 | 
				
			||||||
		dive->id = dive_getUniqID(dive);
 | 
							dive->id = dive_getUniqID(dive);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return dive;
 | 
						return dive;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue