Correzione sulla TAssoc_array::add() eseguita per reference: non
memorizzava il puntatore dell'oggetto duplicato. git-svn-id: svn://10.65.10.50/trunk@4200 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									6d3af133ad
								
							
						
					
					
						commit
						f1cccccc5f
					
				@ -32,12 +32,15 @@ THash_object* TAssoc_array::_lookup(
 | 
				
			|||||||
      break;
 | 
					      break;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (o == NULL && insert) 
 | 
					  if (o == NULL) 
 | 
				
			||||||
  { 
 | 
					  { 
 | 
				
			||||||
    o = new THash_object(key);
 | 
					    if (insert)
 | 
				
			||||||
    arr.insert(o,i); 
 | 
					    {
 | 
				
			||||||
 | 
					      o = new THash_object(key);
 | 
				
			||||||
 | 
					      arr.insert(o,i); 
 | 
				
			||||||
 | 
					      _cnt++;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    isnew = TRUE;
 | 
					    isnew = TRUE;
 | 
				
			||||||
    _cnt++;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  return o;
 | 
					  return o;
 | 
				
			||||||
@ -156,7 +159,7 @@ bool TAssoc_array::add(
 | 
				
			|||||||
bool TAssoc_array::add(const char* key, const TObject& obj, bool force)
 | 
					bool TAssoc_array::add(const char* key, const TObject& obj, bool force)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  bool isnew = FALSE;
 | 
					  bool isnew = FALSE;
 | 
				
			||||||
  THash_object* o = _lookup(key,isnew,TRUE);
 | 
					  THash_object* o = _lookup(key,isnew,FALSE); // Non inserire l'Hash_object se non lo trovi (ci pensa la add sotto)
 | 
				
			||||||
  if (!isnew && !force)
 | 
					  if (!isnew && !force)
 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user