mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 08:20:05 +00:00 
			
		
		
		
	Avoid invalid iterator comparison after objects mutex is unlocked
This commit is contained in:
		
							parent
							
								
									845d5b5707
								
							
						
					
					
						commit
						f7949cc404
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -183,6 +183,7 @@ AwsNexradDataProvider::GetTimePointsByDate( | |||
|    std::shared_lock lock(p->objectsMutex_); | ||||
| 
 | ||||
|    // Is the date present in the date list?
 | ||||
|    bool currentDatePresent; | ||||
|    auto currentDateIterator = | ||||
|       std::find(p->objectDates_.cbegin(), p->objectDates_.cend(), day); | ||||
|    if (currentDateIterator == p->objectDates_.cend()) | ||||
|  | @ -199,6 +200,12 @@ AwsNexradDataProvider::GetTimePointsByDate( | |||
| 
 | ||||
|       // Re-lock mutex
 | ||||
|       lock.lock(); | ||||
| 
 | ||||
|       currentDatePresent = false; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       currentDatePresent = true; | ||||
|    } | ||||
| 
 | ||||
|    // Determine objects to retrieve
 | ||||
|  | @ -216,7 +223,7 @@ AwsNexradDataProvider::GetTimePointsByDate( | |||
| 
 | ||||
|    // If we haven't updated the most recently queried dates yet, because the
 | ||||
|    // date was already cached, update
 | ||||
|    if (currentDateIterator != p->objectDates_.cend()) | ||||
|    if (currentDatePresent) | ||||
|    { | ||||
|       p->UpdateObjectDates(date); | ||||
|    } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat