diff options
author | Rye Cogtail <rye@lindenlab.com> | 2024-10-30 16:07:33 -0400 |
---|---|---|
committer | Rye <rye@lindenlab.com> | 2024-11-04 04:10:23 -0500 |
commit | eee46669d89385745037e9ad4bfb1c27a2597fa2 (patch) | |
tree | 827d0f0767984b6d4bf3b81de557e34cbf6ba7b4 | |
parent | a4bd6ccb6a5813f2a9e7021f25886a0c34cc8392 (diff) |
Fix leak of boost signal objects in marketplace functions
-rw-r--r-- | indra/newview/llmarketplacefunctions.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llmarketplacefunctions.h | 10 |
2 files changed, 14 insertions, 19 deletions
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 7b8211ded8..53ea345858 100644 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -450,17 +450,14 @@ LLMarketplaceInventoryImporter::LLMarketplaceInventoryImporter() , mImportInProgress(false) , mInitialized(false) , mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED) - , mErrorInitSignal(NULL) - , mStatusChangedSignal(NULL) - , mStatusReportSignal(NULL) { } boost::signals2::connection LLMarketplaceInventoryImporter::setInitializationErrorCallback(const status_report_signal_t::slot_type& cb) { - if (mErrorInitSignal == NULL) + if (mErrorInitSignal == nullptr) { - mErrorInitSignal = new status_report_signal_t(); + mErrorInitSignal = std::make_unique<status_report_signal_t>(); } return mErrorInitSignal->connect(cb); @@ -468,9 +465,9 @@ boost::signals2::connection LLMarketplaceInventoryImporter::setInitializationErr boost::signals2::connection LLMarketplaceInventoryImporter::setStatusChangedCallback(const status_changed_signal_t::slot_type& cb) { - if (mStatusChangedSignal == NULL) + if (mStatusChangedSignal == nullptr) { - mStatusChangedSignal = new status_changed_signal_t(); + mStatusChangedSignal = std::make_unique<status_changed_signal_t>(); } return mStatusChangedSignal->connect(cb); @@ -478,9 +475,9 @@ boost::signals2::connection LLMarketplaceInventoryImporter::setStatusChangedCall boost::signals2::connection LLMarketplaceInventoryImporter::setStatusReportCallback(const status_report_signal_t::slot_type& cb) { - if (mStatusReportSignal == NULL) + if (mStatusReportSignal == nullptr) { - mStatusReportSignal = new status_report_signal_t(); + mStatusReportSignal = std::make_unique<status_report_signal_t>(); } return mStatusReportSignal->connect(cb); @@ -717,8 +714,6 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id, LLMarketplaceData::LLMarketplaceData() : mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED), mMarketPlaceDataFetched(MarketplaceFetchCodes::MARKET_FETCH_NOT_DONE), - mStatusUpdatedSignal(NULL), - mDataFetchedSignal(NULL), mDirtyCount(false) { mInventoryObserver = new LLMarketplaceInventoryObserver; @@ -752,9 +747,9 @@ LLSD LLMarketplaceData::getMarketplaceStringSubstitutions() void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type& cb) { - if (mStatusUpdatedSignal == NULL) + if (mStatusUpdatedSignal == nullptr) { - mStatusUpdatedSignal = new status_updated_signal_t(); + mStatusUpdatedSignal = std::make_unique<status_updated_signal_t>(); } mStatusUpdatedSignal->connect(cb); @@ -842,7 +837,7 @@ void LLMarketplaceData::setDataFetchedSignal(const status_updated_signal_t::slot { if (mDataFetchedSignal == NULL) { - mDataFetchedSignal = new status_updated_signal_t(); + mDataFetchedSignal = std::make_unique<status_updated_signal_t>(); } mDataFetchedSignal->connect(cb); } diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 281743c1d6..4e61b0c7f3 100644 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -113,9 +113,9 @@ private: bool mInitialized; U32 mMarketPlaceStatus; - status_report_signal_t * mErrorInitSignal; - status_changed_signal_t * mStatusChangedSignal; - status_report_signal_t * mStatusReportSignal; + std::unique_ptr<status_report_signal_t> mErrorInitSignal; + std::unique_ptr<status_changed_signal_t> mStatusChangedSignal; + std::unique_ptr<status_report_signal_t> mStatusReportSignal; }; @@ -276,13 +276,13 @@ private: // Handling Marketplace connection and inventory connection U32 mMarketPlaceStatus; std::string mMarketPlaceFailureReason; - status_updated_signal_t* mStatusUpdatedSignal; + std::unique_ptr<status_updated_signal_t> mStatusUpdatedSignal; LLInventoryObserver* mInventoryObserver; bool mDirtyCount; // If true, stock count value need to be updated at the next check // Update data U32 mMarketPlaceDataFetched; - status_updated_signal_t* mDataFetchedSignal; + std::unique_ptr<status_updated_signal_t> mDataFetchedSignal; std::set<LLUUID> mPendingUpdateSet; // Listing folders waiting for validation |