Skip to content

Commit eee4666

Browse files
author
Rye Cogtail
committed
Fix leak of boost signal objects in marketplace functions
1 parent a4bd6cc commit eee4666

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

indra/newview/llmarketplacefunctions.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -450,37 +450,34 @@ LLMarketplaceInventoryImporter::LLMarketplaceInventoryImporter()
450450
, mImportInProgress(false)
451451
, mInitialized(false)
452452
, mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
453-
, mErrorInitSignal(NULL)
454-
, mStatusChangedSignal(NULL)
455-
, mStatusReportSignal(NULL)
456453
{
457454
}
458455

459456
boost::signals2::connection LLMarketplaceInventoryImporter::setInitializationErrorCallback(const status_report_signal_t::slot_type& cb)
460457
{
461-
if (mErrorInitSignal == NULL)
458+
if (mErrorInitSignal == nullptr)
462459
{
463-
mErrorInitSignal = new status_report_signal_t();
460+
mErrorInitSignal = std::make_unique<status_report_signal_t>();
464461
}
465462

466463
return mErrorInitSignal->connect(cb);
467464
}
468465

469466
boost::signals2::connection LLMarketplaceInventoryImporter::setStatusChangedCallback(const status_changed_signal_t::slot_type& cb)
470467
{
471-
if (mStatusChangedSignal == NULL)
468+
if (mStatusChangedSignal == nullptr)
472469
{
473-
mStatusChangedSignal = new status_changed_signal_t();
470+
mStatusChangedSignal = std::make_unique<status_changed_signal_t>();
474471
}
475472

476473
return mStatusChangedSignal->connect(cb);
477474
}
478475

479476
boost::signals2::connection LLMarketplaceInventoryImporter::setStatusReportCallback(const status_report_signal_t::slot_type& cb)
480477
{
481-
if (mStatusReportSignal == NULL)
478+
if (mStatusReportSignal == nullptr)
482479
{
483-
mStatusReportSignal = new status_report_signal_t();
480+
mStatusReportSignal = std::make_unique<status_report_signal_t>();
484481
}
485482

486483
return mStatusReportSignal->connect(cb);
@@ -717,8 +714,6 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id,
717714
LLMarketplaceData::LLMarketplaceData() :
718715
mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED),
719716
mMarketPlaceDataFetched(MarketplaceFetchCodes::MARKET_FETCH_NOT_DONE),
720-
mStatusUpdatedSignal(NULL),
721-
mDataFetchedSignal(NULL),
722717
mDirtyCount(false)
723718
{
724719
mInventoryObserver = new LLMarketplaceInventoryObserver;
@@ -752,9 +747,9 @@ LLSD LLMarketplaceData::getMarketplaceStringSubstitutions()
752747

753748
void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type& cb)
754749
{
755-
if (mStatusUpdatedSignal == NULL)
750+
if (mStatusUpdatedSignal == nullptr)
756751
{
757-
mStatusUpdatedSignal = new status_updated_signal_t();
752+
mStatusUpdatedSignal = std::make_unique<status_updated_signal_t>();
758753
}
759754
mStatusUpdatedSignal->connect(cb);
760755

@@ -842,7 +837,7 @@ void LLMarketplaceData::setDataFetchedSignal(const status_updated_signal_t::slot
842837
{
843838
if (mDataFetchedSignal == NULL)
844839
{
845-
mDataFetchedSignal = new status_updated_signal_t();
840+
mDataFetchedSignal = std::make_unique<status_updated_signal_t>();
846841
}
847842
mDataFetchedSignal->connect(cb);
848843
}

indra/newview/llmarketplacefunctions.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ class LLMarketplaceInventoryImporter
113113
bool mInitialized;
114114
U32 mMarketPlaceStatus;
115115

116-
status_report_signal_t * mErrorInitSignal;
117-
status_changed_signal_t * mStatusChangedSignal;
118-
status_report_signal_t * mStatusReportSignal;
116+
std::unique_ptr<status_report_signal_t> mErrorInitSignal;
117+
std::unique_ptr<status_changed_signal_t> mStatusChangedSignal;
118+
std::unique_ptr<status_report_signal_t> mStatusReportSignal;
119119
};
120120

121121

@@ -276,13 +276,13 @@ class LLMarketplaceData
276276
// Handling Marketplace connection and inventory connection
277277
U32 mMarketPlaceStatus;
278278
std::string mMarketPlaceFailureReason;
279-
status_updated_signal_t* mStatusUpdatedSignal;
279+
std::unique_ptr<status_updated_signal_t> mStatusUpdatedSignal;
280280
LLInventoryObserver* mInventoryObserver;
281281
bool mDirtyCount; // If true, stock count value need to be updated at the next check
282282

283283
// Update data
284284
U32 mMarketPlaceDataFetched;
285-
status_updated_signal_t* mDataFetchedSignal;
285+
std::unique_ptr<status_updated_signal_t> mDataFetchedSignal;
286286
std::set<LLUUID> mPendingUpdateSet;
287287

288288
// Listing folders waiting for validation

0 commit comments

Comments
 (0)