@@ -234,7 +234,7 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL
234
234
get_callback_map_t ::iterator itCallback = mGetCallbacks .find (material_id);
235
235
if (itCallback == mGetCallbacks .end ())
236
236
{
237
- std::pair<get_callback_map_t ::iterator, bool > ret = mGetCallbacks .insert ( std::pair<LLMaterialID, get_callback_t *>(material_id, new get_callback_t () ));
237
+ std::pair<get_callback_map_t ::iterator, bool > ret = mGetCallbacks .emplace (material_id, std::make_unique< get_callback_t >( ));
238
238
itCallback = ret.first ;
239
239
}
240
240
connection = itCallback->second ->connect (cb);;
@@ -279,7 +279,7 @@ boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const
279
279
get_callback_te_map_t ::iterator itCallback = mGetTECallbacks .find (te_mat_pair);
280
280
if (itCallback == mGetTECallbacks .end ())
281
281
{
282
- std::pair<get_callback_te_map_t ::iterator, bool > ret = mGetTECallbacks .insert ( std::pair<TEMaterialPair, get_callback_te_t *>(te_mat_pair, new get_callback_te_t () ));
282
+ std::pair<get_callback_te_map_t ::iterator, bool > ret = mGetTECallbacks .emplace (te_mat_pair, std::make_unique< get_callback_te_t >( ));
283
283
itCallback = ret.first ;
284
284
}
285
285
connection = itCallback->second ->connect (cb);
@@ -317,7 +317,7 @@ boost::signals2::connection LLMaterialMgr::getAll(const LLUUID& region_id, LLMat
317
317
getall_callback_map_t ::iterator itCallback = mGetAllCallbacks .find (region_id);
318
318
if (mGetAllCallbacks .end () == itCallback)
319
319
{
320
- std::pair<getall_callback_map_t ::iterator, bool > ret = mGetAllCallbacks .insert ( std::pair<LLUUID, getall_callback_t *>(region_id, new getall_callback_t () ));
320
+ std::pair<getall_callback_map_t ::iterator, bool > ret = mGetAllCallbacks .emplace (region_id, std::make_unique< getall_callback_t >( ));
321
321
itCallback = ret.first ;
322
322
}
323
323
return itCallback->second ->connect (cb);;
@@ -329,8 +329,8 @@ void LLMaterialMgr::put(const LLUUID& object_id, const U8 te, const LLMaterial&
329
329
if (mPutQueue .end () == itQueue)
330
330
{
331
331
LL_DEBUGS (" Materials" ) << " mPutQueue insert object " << object_id << LL_ENDL;
332
- mPutQueue .insert (std::pair<LLUUID, facematerial_map_t >( object_id, facematerial_map_t () ));
333
- itQueue = mPutQueue . find (object_id) ;
332
+ auto ret = mPutQueue .emplace ( object_id, facematerial_map_t ());
333
+ itQueue = ret. first ;
334
334
}
335
335
336
336
facematerial_map_t ::iterator itFace = itQueue->second .find (te);
@@ -361,7 +361,7 @@ void LLMaterialMgr::setLocalMaterial(const LLUUID& region_id, LLMaterialPtr mate
361
361
}
362
362
363
363
LL_DEBUGS (" Materials" ) << " region " << region_id << " new local material id " << material_id << LL_ENDL;
364
- mMaterials .insert (std::pair<LLMaterialID, LLMaterialPtr>( material_id, material_ptr) );
364
+ mMaterials .emplace ( material_id, material_ptr);
365
365
366
366
setMaterialCallbacks (material_id, material_ptr);
367
367
@@ -376,7 +376,7 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL
376
376
{
377
377
LL_DEBUGS (" Materials" ) << " new material" << LL_ENDL;
378
378
LLMaterialPtr newMaterial (new LLMaterial (material_data));
379
- std::pair<material_map_t ::const_iterator, bool > ret = mMaterials .insert (std::pair<LLMaterialID, LLMaterialPtr>( material_id, newMaterial) );
379
+ std::pair<material_map_t ::const_iterator, bool > ret = mMaterials .emplace ( material_id, newMaterial);
380
380
itMaterial = ret.first ;
381
381
}
382
382
@@ -400,7 +400,6 @@ void LLMaterialMgr::setMaterialCallbacks(const LLMaterialID& material_id, const
400
400
if (itCallbackTE != mGetTECallbacks .end ())
401
401
{
402
402
(*itCallbackTE->second )(material_id, material_ptr, te_mat_pair.te );
403
- delete itCallbackTE->second ;
404
403
mGetTECallbacks .erase (itCallbackTE);
405
404
}
406
405
}
@@ -410,7 +409,6 @@ void LLMaterialMgr::setMaterialCallbacks(const LLMaterialID& material_id, const
410
409
{
411
410
(*itCallback->second )(material_id, material_ptr);
412
411
413
- delete itCallback->second ;
414
412
mGetCallbacks .erase (itCallback);
415
413
}
416
414
}
@@ -509,7 +507,6 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL
509
507
{
510
508
(*itCallback->second )(region_id, materials);
511
509
512
- delete itCallback->second ;
513
510
mGetAllCallbacks .erase (itCallback);
514
511
}
515
512
@@ -549,11 +546,11 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content)
549
546
{
550
547
llassert (response_data.isArray ());
551
548
LL_DEBUGS (" Materials" ) << " response has " << response_data.size () << " materials" << LL_ENDL;
549
+ #ifdef SHOW_ASSERT // same condition that controls llassert()
552
550
for (LLSD::array_const_iterator faceIter = response_data.beginArray (); faceIter != response_data.endArray (); ++faceIter)
553
551
{
554
- # ifdef SHOW_ASSERT // same condition that controls llassert()
555
552
const LLSD& face_data = *faceIter; // conditional to avoid unused variable warning
556
- # endif
553
+
557
554
llassert (face_data.isMap ());
558
555
559
556
llassert (face_data.has (MATERIALS_CAP_OBJECT_ID_FIELD));
@@ -570,6 +567,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content)
570
567
571
568
// *TODO: do we really still need to process this?
572
569
}
570
+ #endif
573
571
}
574
572
}
575
573
0 commit comments