Revision 83d158d6 src/pool/PoolSQL.cc

View differences:

src/pool/PoolSQL.cc
194 194

  
195 195
    pool.insert(make_pair(objectsql->oid, objectsql));
196 196

  
197
    if ( uses_name_pool )
198
    {
199
        string okey = key(objectsql->name, objectsql->uid);
200

  
201
        name_pool.insert(make_pair(okey, objectsql));
202
    }
203

  
197 204
    if ( olock == true )
198 205
    {
199 206
        objectsql->lock();
......
262 269
    for (it = pool.begin(); it != pool.end(); )
263 270
    {
264 271
        // The object we are looking for in ::get(). Wait until it is unlocked()
265
        if (it->second->oid == oid)
272
        if (it->first == oid)
266 273
        {
267 274
            it->second->lock();
268 275
        }
......
281 288
        tmp_ptr = it->second;
282 289

  
283 290
        // map::erase does not invalidate iterator, except for the current one
284
        pool.erase(it++);
291
        it = pool.erase(it);
285 292

  
286 293
        if ( uses_name_pool )
287 294
        {
288
            string okey = key(tmp_ptr->name,tmp_ptr->uid);
295
            string okey = key(tmp_ptr->name, tmp_ptr->uid);
289 296

  
290 297
            name_pool.erase(okey);
291 298
        }
......
306 313

  
307 314
    for (it = name_pool.begin(); it != name_pool.end(); )
308 315
    {
309
        string okey = key(it->second->name, it->second->uid);
310

  
311 316
        // The object we are looking for in ::get(). Wait until it is unlocked()
312
        if (name_key == okey)
317
        if (name_key == it->first)
313 318
        {
314 319
            it->second->lock();
315 320
        }
......
328 333
        tmp_ptr = it->second;
329 334

  
330 335
        // map::erase does not invalidate iterator, except for the current one
331
        name_pool.erase(it++);
336
        it = name_pool.erase(it);
332 337

  
333 338
        pool.erase(tmp_ptr->oid);
334 339

  

Also available in: Unified diff