From b63c21a13eb4bb5bb6630bc360de2383814816c9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 27 Sep 2012 14:13:03 -0500 Subject: Modify installer to remove libtcmalloc_minimal.dll --- indra/newview/viewer_manifest.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 894d2f0925..027bdbfb30 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -404,11 +404,9 @@ class WindowsManifest(ViewerManifest): self.path("libhunspell.dll") # For google-perftools tcmalloc allocator. + # no longer used, make sure old .dll is removed try: - if self.args['configuration'].lower() == 'debug': - self.path('libtcmalloc_minimal-debug.dll') - else: - self.path('libtcmalloc_minimal.dll') + self.remove('libtcmalloc_minimal.dll') except: print "Skipping libtcmalloc_minimal.dll" -- cgit v1.2.3 From 39907b9b565eafb859101e67d0a49a69e409241a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 27 Sep 2012 14:52:10 -0500 Subject: Another attempt at deleting tcmalloc_minimal.dll --- indra/newview/viewer_manifest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 027bdbfb30..175c6f9903 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -406,7 +406,7 @@ class WindowsManifest(ViewerManifest): # For google-perftools tcmalloc allocator. # no longer used, make sure old .dll is removed try: - self.remove('libtcmalloc_minimal.dll') + self.remove(self.dst_path_of('libtcmalloc_minimal.dll')) except: print "Skipping libtcmalloc_minimal.dll" -- cgit v1.2.3 From 603a48af9479ad119a4526a80ac24c866c2bc1c9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 27 Sep 2012 17:01:57 -0500 Subject: Yet another attempt at deleting tcmalloc --- indra/newview/viewer_manifest.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 175c6f9903..87366caf1b 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -404,9 +404,11 @@ class WindowsManifest(ViewerManifest): self.path("libhunspell.dll") # For google-perftools tcmalloc allocator. - # no longer used, make sure old .dll is removed try: - self.remove(self.dst_path_of('libtcmalloc_minimal.dll')) + if self.args['configuration'].lower() == 'debug': + self.path('libtcmalloc_minimal-debug.dll') + else: + self.path('libtcmalloc_minimal.dll') except: print "Skipping libtcmalloc_minimal.dll" @@ -535,6 +537,10 @@ class WindowsManifest(ViewerManifest): result += 'File ' + pkg_file + '\n' else: result += 'Delete ' + wpath(os.path.join('$INSTDIR', rel_file)) + '\n' + + if install + result += 'Delete ' + wpath(os.path.join('$INSTDIR', 'libtcmalloc_minimal.dll')) + '\n' + # at the end of a delete, just rmdir all the directories if not install: deleted_file_dirs = [os.path.dirname(pair[1].replace(self.get_dst_prefix()+os.path.sep,'')) for pair in self.file_list] -- cgit v1.2.3 From c69855f2333f9fb094e235b84d275d43fdeda3c3 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 1 Oct 2012 16:26:12 -0500 Subject: Only enable breakpad error handing if crash reporting is enabled --- indra/llcommon/llapp.cpp | 3 ++- indra/llcommon/llqueuedthread.cpp | 4 ++-- indra/newview/llappviewerwin32.cpp | 5 ++++- indra/newview/viewer_manifest.py | 3 --- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index ed192a9975..ca258900c7 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -289,6 +289,7 @@ void LLApp::setupErrorHandling() // occasionally checks to see if the app is in an error state, and sees if it needs to be run. #if LL_WINDOWS +#if LL_SEND_CRASH_REPORTS // This sets a callback to handle w32 signals to the console window. // The viewer shouldn't be affected, sicne its a windowed app. SetConsoleCtrlHandler( (PHANDLER_ROUTINE) ConsoleCtrlHandler, TRUE); @@ -300,7 +301,7 @@ void LLApp::setupErrorHandling() mExceptionHandler = new google_breakpad::ExceptionHandler( L"C:\\Temp\\", 0, windows_post_minidump_callback, 0, google_breakpad::ExceptionHandler::HANDLER_ALL); } - +#endif #else // // Start up signal handling. diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 1738c16dea..abf47a0f57 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -134,8 +134,8 @@ S32 LLQueuedThread::updateQueue(F32 max_time_ms) pending = getPending(); if(pending > 0) { - unpause(); - } + unpause(); + } } else { diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 53c77fa22e..e0ca1232b0 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -131,7 +131,9 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1 // Enable to get mem debugging within visual studio. - //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); +#if LL_DEBUG + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); +#else _CrtSetDbgFlag(0); // default, just making explicit ULONG ulEnableLFH = 2; @@ -145,6 +147,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, else heap_enable_lfh_error[i] = GetLastError(); } +#endif #endif // *FIX: global diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 87366caf1b..61d99333c2 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -538,9 +538,6 @@ class WindowsManifest(ViewerManifest): else: result += 'Delete ' + wpath(os.path.join('$INSTDIR', rel_file)) + '\n' - if install - result += 'Delete ' + wpath(os.path.join('$INSTDIR', 'libtcmalloc_minimal.dll')) + '\n' - # at the end of a delete, just rmdir all the directories if not install: deleted_file_dirs = [os.path.dirname(pair[1].replace(self.get_dst_prefix()+os.path.sep,'')) for pair in self.file_list] -- cgit v1.2.3 From bc0abc773451d5a71f7f0b024e8d389327425446 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 2 Oct 2012 12:11:42 -0500 Subject: Fix up some assertions in lloctree.h --- indra/newview/lldrawable.cpp | 12 +++++++++++- indra/newview/llspatialpartition.cpp | 4 ++-- indra/newview/llspatialpartition.h | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 108ec92f6d..0722e66571 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -945,6 +945,12 @@ void LLDrawable::updateUVMinMax() void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp) { + //precondition: mSpatialGroupp MUST be null or DEAD or mSpatialGroupp MUST NOT contain this + llassert(!mSpatialGroupp || mSpatialGroupp->isDead() || !mSpatialGroupp->hasElement(this)); + + //precondition: groupp MUST be null or groupp MUST contain this + llassert(!groupp || groupp->hasElement(this)); + /*if (mSpatialGroupp && (groupp != mSpatialGroupp)) { mSpatialGroupp->setState(LLSpatialGroup::GEOM_DIRTY); @@ -1468,6 +1474,10 @@ void LLSpatialBridge::cleanupReferences() LLDrawable::cleanupReferences(); if (mDrawable) { + /* + + DON'T DO THIS -- this should happen through octree destruction + mDrawable->setSpatialGroup(NULL); if (mDrawable->getVObj()) { @@ -1482,7 +1492,7 @@ void LLSpatialBridge::cleanupReferences() drawable->setSpatialGroup(NULL); } } - } + }*/ LLDrawable* drawablep = mDrawable; mDrawable = NULL; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 45ef8f1a6d..9a6cb78333 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1841,13 +1841,13 @@ BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp) { LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); - drawablep->setSpatialGroup(NULL); - if (!curp->removeObject(drawablep)) { OCT_ERRS << "Failed to remove drawable from octree!" << llendl; } + drawablep->setSpatialGroup(NULL); + assert_octree_valid(mOctree); return TRUE; diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 7968c28900..d3cda2ff6a 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -346,6 +346,8 @@ public: void dirtyGeom() { setState(GEOM_DIRTY); } void dirtyMesh() { setState(MESH_DIRTY); } element_list& getData() { return mOctreeNode->getData(); } + bool hasElement(LLDrawable* drawablep) { return mOctreeNode->getData().find(drawablep) != mOctreeNode->getData().end(); } + U32 getElementCount() const { return mOctreeNode->getElementCount(); } void drawObjectBox(LLColor4 col); -- cgit v1.2.3 From 05dbd7dafe0e060e82aeedb5404101367bd4c622 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 2 Oct 2012 16:06:14 -0500 Subject: Instrument debug builds on windows to help track down source of heap corruption --- indra/llcommon/llmemory.h | 7 +++++++ indra/llmessage/llcurl.cpp | 42 +++++++++++++++++++++++++++++++++++++----- indra/newview/llappviewer.cpp | 2 ++ 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index f37e8459ff..fd3b9d342a 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -27,6 +27,13 @@ #define LLMEMORY_H #include "llmemtype.h" + +#if LL_WINDOWS && LL_DEBUG +#define LL_CHECK_MEMORY llassert(_CrtCheckMemory()); +#else +#define LL_CHECK_MEMORY +#endif + inline void* ll_aligned_malloc( size_t size, int align ) { void* mem = malloc( size + (align - 1) + sizeof(void*) ); diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 5ea9b58300..0de47e0181 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -315,18 +315,23 @@ LLCurl::Easy* LLCurl::Easy::getEasy() LLCurl::Easy::~Easy() { + LL_CHECK_MEMORY releaseEasyHandle(mCurlEasyHandle); + LL_CHECK_MEMORY --gCurlEasyCount; curl_slist_free_all(mHeaders); + LL_CHECK_MEMORY for_each(mStrings.begin(), mStrings.end(), DeletePointerArray()); - + LL_CHECK_MEMORY if (mResponder && LLCurl::sNotQuitting) //aborted { std::string reason("Request timeout, aborted.") ; mResponder->completedRaw(408, //HTTP_REQUEST_TIME_OUT, timeout, abort reason, mChannels, mOutput); + LL_CHECK_MEMORY } mResponder = NULL; + LL_CHECK_MEMORY } void LLCurl::Easy::resetState() @@ -599,35 +604,49 @@ void LLCurl::Multi::cleanup(bool deleted) llassert_always(deleted || !mValid) ; LLMutexLock lock(mDeletionMutexp); - + + // Clean up active for(easy_active_list_t::iterator iter = mEasyActiveList.begin(); iter != mEasyActiveList.end(); ++iter) { Easy* easy = *iter; + LL_CHECK_MEMORY check_curl_multi_code(curl_multi_remove_handle(mCurlMultiHandle, easy->getCurlHandle())); - + LL_CHECK_MEMORY if(deleted) { easy->mResponder = NULL ; //avoid triggering mResponder. } delete easy; + LL_CHECK_MEMORY } mEasyActiveList.clear(); mEasyActiveMap.clear(); - // Clean up freed + LL_CHECK_MEMORY + + // Clean up freed for_each(mEasyFreeList.begin(), mEasyFreeList.end(), DeletePointer()); mEasyFreeList.clear(); - + + LL_CHECK_MEMORY + check_curl_multi_code(LLCurl::deleteMultiHandle(mCurlMultiHandle)); mCurlMultiHandle = NULL ; + + LL_CHECK_MEMORY delete mMutexp ; mMutexp = NULL ; + + LL_CHECK_MEMORY + delete mEasyMutexp ; mEasyMutexp = NULL ; + LL_CHECK_MEMORY + mQueued = 0 ; mState = STATE_COMPLETED; @@ -1504,29 +1523,42 @@ void LLCurl::cleanupClass() break ; } } + LL_CHECK_MEMORY sCurlThread->shutdown() ; + LL_CHECK_MEMORY delete sCurlThread ; sCurlThread = NULL ; + LL_CHECK_MEMORY #if SAFE_SSL CRYPTO_set_locking_callback(NULL); for_each(sSSLMutex.begin(), sSSLMutex.end(), DeletePointer()); #endif + + LL_CHECK_MEMORY for (std::set::iterator iter = Easy::sFreeHandles.begin(); iter != Easy::sFreeHandles.end(); ++iter) { CURL* curl = *iter; LLCurl::deleteEasyHandle(curl); } + + LL_CHECK_MEMORY Easy::sFreeHandles.clear(); + LL_CHECK_MEMORY + delete Easy::sHandleMutexp ; Easy::sHandleMutexp = NULL ; + LL_CHECK_MEMORY + delete sHandleMutexp ; sHandleMutexp = NULL ; + LL_CHECK_MEMORY + // removed as per https://jira.secondlife.com/browse/SH-3115 //llassert(Easy::sActiveHandles.empty()); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index e8934d9a9e..fa68b9322e 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1958,7 +1958,9 @@ bool LLAppViewer::cleanup() end_messaging_system(); // *NOTE:Mani - The following call is not thread safe. + LL_CHECK_MEMORY LLCurl::cleanupClass(); + LL_CHECK_MEMORY // If we're exiting to launch an URL, do that here so the screen // is at the right resolution before we launch IE. -- cgit v1.2.3 From 374f20edf09ff8194c715d190c114eaacac00bfe Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Oct 2012 14:30:21 -0500 Subject: Fix non-thread-safe refcounting of LLHTTPClient::Responder and fix out-of-order deletion of LLTextureFetch on shutdown --- indra/llcommon/llthread.cpp | 35 ++++++++++++++----- indra/llcommon/llthread.h | 30 ++++++++++++----- indra/llmessage/llcurl.cpp | 38 +++++++-------------- indra/llmessage/llcurl.h | 15 +++------ indra/newview/llappviewer.cpp | 6 ++-- indra/newview/llassetuploadresponders.cpp | 8 ++--- indra/newview/lleventpoll.cpp | 2 +- indra/newview/llfloatertos.cpp | 6 ++-- indra/newview/lltexturefetch.cpp | 2 ++ indra/newview/lltranslate.h | 4 +-- indra/newview/llviewermessage.cpp | 4 +-- indra/newview/llviewerregion.cpp | 5 ++- .../viewer_components/updater/llupdatechecker.cpp | 39 +--------------------- indra/viewer_components/updater/llupdatechecker.h | 34 +++++++++++++++++-- 14 files changed, 117 insertions(+), 111 deletions(-) diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index a6ad6b125c..c2fbb544a8 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -114,7 +114,7 @@ LLThread::LLThread(const std::string& name, apr_pool_t *poolp) : apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread } mRunCondition = new LLCondition(mAPRPoolp); - + mDataLock = new LLMutex(mAPRPoolp); mLocalAPRFilePoolp = NULL ; } @@ -173,7 +173,10 @@ void LLThread::shutdown() } delete mRunCondition; - mRunCondition = 0; + mRunCondition = NULL; + + delete mDataLock; + mDataLock = NULL; if (mIsLocalPool && mAPRPoolp) { @@ -242,28 +245,30 @@ bool LLThread::runCondition(void) // Stop thread execution if requested until unpaused. void LLThread::checkPause() { - mRunCondition->lock(); + mDataLock->lock(); // This is in a while loop because the pthread API allows for spurious wakeups. while(shouldSleep()) { + mDataLock->unlock(); mRunCondition->wait(); // unlocks mRunCondition + mDataLock->lock(); // mRunCondition is locked when the thread wakes up } - mRunCondition->unlock(); + mDataLock->unlock(); } //============================================================================ void LLThread::setQuitting() { - mRunCondition->lock(); + mDataLock->lock(); if (mStatus == RUNNING) { mStatus = QUITTING; } - mRunCondition->unlock(); + mDataLock->unlock(); wake(); } @@ -285,12 +290,12 @@ void LLThread::yield() void LLThread::wake() { - mRunCondition->lock(); + mDataLock->lock(); if(!shouldSleep()) { mRunCondition->signal(); } - mRunCondition->unlock(); + mDataLock->unlock(); } void LLThread::wakeLocked() @@ -481,6 +486,19 @@ LLThreadSafeRefCount::LLThreadSafeRefCount() : { } +LLThreadSafeRefCount::LLThreadSafeRefCount(const LLThreadSafeRefCount& src) +{ + if (sMutex) + { + sMutex->lock(); + } + mRef = 0; + if (sMutex) + { + sMutex->unlock(); + } +} + LLThreadSafeRefCount::~LLThreadSafeRefCount() { if (mRef != 0) @@ -489,6 +507,7 @@ LLThreadSafeRefCount::~LLThreadSafeRefCount() } } + //============================================================================ LLResponder::~LLResponder() diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index b52e70ab2e..892e144911 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -97,6 +97,7 @@ private: protected: std::string mName; LLCondition* mRunCondition; + LLMutex* mDataLock; apr_thread_t *mAPRThreadp; apr_pool_t *mAPRPoolp; @@ -122,15 +123,15 @@ protected: inline void unlockData(); // This is the predicate that decides whether the thread should sleep. - // It should only be called with mRunCondition locked, since the virtual runCondition() function may need to access + // It should only be called with mDataLock locked, since the virtual runCondition() function may need to access // data structures that are thread-unsafe. bool shouldSleep(void) { return (mStatus == RUNNING) && (isPaused() || (!runCondition())); } // To avoid spurious signals (and the associated context switches) when the condition may or may not have changed, you can do the following: - // mRunCondition->lock(); + // mDataLock->lock(); // if(!shouldSleep()) // mRunCondition->signal(); - // mRunCondition->unlock(); + // mDataLock->unlock(); }; //============================================================================ @@ -205,12 +206,12 @@ private: void LLThread::lockData() { - mRunCondition->lock(); + mDataLock->lock(); } void LLThread::unlockData() { - mRunCondition->unlock(); + mDataLock->unlock(); } @@ -227,15 +228,26 @@ public: private: static LLMutex* sMutex; -private: - LLThreadSafeRefCount(const LLThreadSafeRefCount&); // not implemented - LLThreadSafeRefCount&operator=(const LLThreadSafeRefCount&); // not implemented - protected: virtual ~LLThreadSafeRefCount(); // use unref() public: LLThreadSafeRefCount(); + LLThreadSafeRefCount(const LLThreadSafeRefCount&); + LLThreadSafeRefCount&operator=(const LLThreadSafeRefCount& ref) + { + if (sMutex) + { + sMutex->lock(); + } + mRef = 0; + if (sMutex) + { + sMutex->unlock(); + } + } + + void ref() { diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 0de47e0181..158e4ce091 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -133,12 +133,12 @@ std::string LLCurl::getVersionString() ////////////////////////////////////////////////////////////////////////////// LLCurl::Responder::Responder() - : mReferenceCount(0) { } LLCurl::Responder::~Responder() { + LL_CHECK_MEMORY } // virtual @@ -202,23 +202,6 @@ void LLCurl::Responder::completedHeader(U32 status, const std::string& reason, c } -namespace boost -{ - void intrusive_ptr_add_ref(LLCurl::Responder* p) - { - ++p->mReferenceCount; - } - - void intrusive_ptr_release(LLCurl::Responder* p) - { - if (p && 0 == --p->mReferenceCount) - { - delete p; - } - } -}; - - ////////////////////////////////////////////////////////////////////////////// std::set LLCurl::Easy::sFreeHandles; @@ -267,15 +250,18 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle) LLMutexLock lock(sHandleMutexp) ; if (sActiveHandles.find(handle) != sActiveHandles.end()) { + LL_CHECK_MEMORY sActiveHandles.erase(handle); - + LL_CHECK_MEMORY if(sFreeHandles.size() < MAX_NUM_FREE_HANDLES) { - sFreeHandles.insert(handle); - } - else - { + sFreeHandles.insert(handle); + LL_CHECK_MEMORY + } + else + { LLCurl::deleteEasyHandle(handle) ; + LL_CHECK_MEMORY } } else @@ -315,9 +301,7 @@ LLCurl::Easy* LLCurl::Easy::getEasy() LLCurl::Easy::~Easy() { - LL_CHECK_MEMORY releaseEasyHandle(mCurlEasyHandle); - LL_CHECK_MEMORY --gCurlEasyCount; curl_slist_free_all(mHeaders); LL_CHECK_MEMORY @@ -331,7 +315,6 @@ LLCurl::Easy::~Easy() LL_CHECK_MEMORY } mResponder = NULL; - LL_CHECK_MEMORY } void LLCurl::Easy::resetState() @@ -617,6 +600,7 @@ void LLCurl::Multi::cleanup(bool deleted) if(deleted) { easy->mResponder = NULL ; //avoid triggering mResponder. + LL_CHECK_MEMORY } delete easy; LL_CHECK_MEMORY @@ -1623,7 +1607,9 @@ void LLCurl::deleteEasyHandle(CURL* handle) if(handle) { LLMutexLock lock(sHandleMutexp) ; + LL_CHECK_MEMORY curl_easy_cleanup(handle) ; + LL_CHECK_MEMORY sTotalHandles-- ; } } diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index d6a7714d4c..62947bdb9d 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -44,6 +44,8 @@ #include "llthread.h" #include "llqueuedthread.h" #include "llframetimer.h" +#include "llpointer.h" + class LLMutex; class LLCurlThread; @@ -67,7 +69,7 @@ public: F64 mSpeedDownload; }; - class Responder + class Responder : public LLThreadSafeRefCount { //LOG_CLASS(Responder); public: @@ -126,13 +128,10 @@ public: return false; } - public: /* but not really -- don't touch this */ - U32 mReferenceCount; - private: std::string mURL; }; - typedef boost::intrusive_ptr ResponderPtr; + typedef LLPointer ResponderPtr; /** @@ -378,12 +377,6 @@ private: void cleanupMulti(LLCurl::Multi* multi) ; } ; -namespace boost -{ - void intrusive_ptr_add_ref(LLCurl::Responder* p); - void intrusive_ptr_release(LLCurl::Responder* p); -}; - class LLCurlRequest { diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index fa68b9322e..2b6d6d15fa 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1888,8 +1888,6 @@ bool LLAppViewer::cleanup() delete sTextureCache; sTextureCache = NULL; - delete sTextureFetch; - sTextureFetch = NULL; delete sImageDecodeThread; sImageDecodeThread = NULL; delete mFastTimerLogThread; @@ -1962,6 +1960,10 @@ bool LLAppViewer::cleanup() LLCurl::cleanupClass(); LL_CHECK_MEMORY + //MUST happen AFTER LLCurl::cleanupClass + delete sTextureFetch; + sTextureFetch = NULL; + // If we're exiting to launch an URL, do that here so the screen // is at the right resolution before we launch IE. if (!gLaunchFileOnQuit.empty()) diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 65bfc990d1..7b2c536f5a 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -919,7 +919,7 @@ public: bool uploadConfirmationCallback( const LLSD& notification, const LLSD& response, - boost::intrusive_ptr responder) + LLPointer responder) { S32 option; std::string confirmation_url; @@ -949,7 +949,7 @@ public: void confirmUpload( const std::string& confirmation_url, - boost::intrusive_ptr responder) + LLPointer responder) { if ( getFilename().empty() ) { @@ -1124,7 +1124,7 @@ void LLNewAgentInventoryVariablePriceResponder::showConfirmationDialog( // and cause sadness. mImpl->confirmUpload( confirmation_url, - boost::intrusive_ptr(this)); + LLPointer(this)); } else { @@ -1157,7 +1157,7 @@ void LLNewAgentInventoryVariablePriceResponder::showConfirmationDialog( mImpl, _1, _2, - boost::intrusive_ptr(this))); + LLPointer(this))); } } diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 4f4d9a40b4..2c786b7f8b 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -86,7 +86,7 @@ namespace class LLEventPollEventTimer : public LLEventTimer { - typedef boost::intrusive_ptr EventPollResponderPtr; + typedef LLPointer EventPollResponderPtr; public: LLEventPollEventTimer(F32 period, EventPollResponderPtr responder) diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index c5df7e16e9..a242b224cd 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -71,9 +71,9 @@ class LLIamHere : public LLHTTPClient::Responder public: - static boost::intrusive_ptr< LLIamHere > build( LLFloaterTOS* parent ) + static LLIamHere* build( LLFloaterTOS* parent ) { - return boost::intrusive_ptr< LLIamHere >( new LLIamHere( parent ) ); + return new LLIamHere( parent ); }; virtual void setParent( LLFloaterTOS* parentIn ) @@ -102,7 +102,7 @@ class LLIamHere : public LLHTTPClient::Responder // this is global and not a class member to keep crud out of the header file namespace { - boost::intrusive_ptr< LLIamHere > gResponsePtr = 0; + LLPointer< LLIamHere > gResponsePtr = 0; }; BOOL LLFloaterTOS::postBuild() diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 7e6dfbc9d9..a5eebf6c77 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -2944,7 +2944,9 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) ~lcl_responder() { + LL_CHECK_MEMORY mFetcher->decrCurlPOSTCount(); + LL_CHECK_MEMORY } // virtual diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h index c58e1adb8c..db5ad9479c 100755 --- a/indra/newview/lltranslate.h +++ b/indra/newview/lltranslate.h @@ -263,8 +263,8 @@ public : EService mService; }; - typedef boost::intrusive_ptr TranslationReceiverPtr; - typedef boost::intrusive_ptr KeyVerificationReceiverPtr; + typedef LLPointer TranslationReceiverPtr; + typedef LLPointer KeyVerificationReceiverPtr; /** * Translate given text. diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7d7d1f3047..04c7a87374 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3339,9 +3339,9 @@ public : { } - static boost::intrusive_ptr build(const std::string &from_lang, const std::string &to_lang, const std::string &mesg, const LLChat &chat, const LLSD &toast_args) + static ChatTranslationReceiver* build(const std::string &from_lang, const std::string &to_lang, const std::string &mesg, const LLChat &chat, const LLSD &toast_args) { - return boost::intrusive_ptr(new ChatTranslationReceiver(from_lang, to_lang, mesg, chat, toast_args)); + return new ChatTranslationReceiver(from_lang, to_lang, mesg, chat, toast_args); } protected: diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 493195aaa3..1ef729e2ff 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -255,10 +255,9 @@ public: } } - static boost::intrusive_ptr build( U64 region_handle, S32 id ) + static BaseCapabilitiesComplete* build( U64 region_handle, S32 id ) { - return boost::intrusive_ptr( - new BaseCapabilitiesComplete(region_handle, id) ); + return new BaseCapabilitiesComplete(region_handle, id); } private: diff --git a/indra/viewer_components/updater/llupdatechecker.cpp b/indra/viewer_components/updater/llupdatechecker.cpp index 4da774a5f6..5edbbf9914 100644 --- a/indra/viewer_components/updater/llupdatechecker.cpp +++ b/indra/viewer_components/updater/llupdatechecker.cpp @@ -51,37 +51,6 @@ public: }; -class LLUpdateChecker::Implementation: - public LLHTTPClient::Responder -{ -public: - Implementation(Client & client); - ~Implementation(); - void checkVersion(std::string const & protocolVersion, std::string const & hostUrl, - std::string const & servicePath, std::string channel, std::string version); - - // Responder: - virtual void completed(U32 status, - const std::string & reason, - const LLSD& content); - virtual void error(U32 status, const std::string & reason); - -private: - static const char * sProtocolVersion; - - Client & mClient; - LLHTTPClient mHttpClient; - bool mInProgress; - std::string mVersion; - - std::string buildUrl(std::string const & protocolVersion, std::string const & hostUrl, - std::string const & servicePath, std::string channel, std::string version); - - LOG_CLASS(LLUpdateChecker::Implementation); -}; - - - // LLUpdateChecker //----------------------------------------------------------------------------- @@ -134,13 +103,7 @@ void LLUpdateChecker::Implementation::checkVersion(std::string const & protocolV std::string checkUrl = buildUrl(protocolVersion, hostUrl, servicePath, channel, version); LL_INFOS("UpdateCheck") << "checking for updates at " << checkUrl << llendl; - // The HTTP client will wrap a raw pointer in a boost::intrusive_ptr causing the - // passed object to be silently and automatically deleted. We pass a self- - // referential intrusive pointer to which we add a reference to keep the - // client from deleting the update checker implementation instance. - LLHTTPClient::ResponderPtr temporaryPtr(this); - boost::intrusive_ptr_add_ref(temporaryPtr.get()); - mHttpClient.get(checkUrl, temporaryPtr); + mHttpClient.get(checkUrl, this); } void LLUpdateChecker::Implementation::completed(U32 status, diff --git a/indra/viewer_components/updater/llupdatechecker.h b/indra/viewer_components/updater/llupdatechecker.h index d882169068..23f62a7c5e 100644 --- a/indra/viewer_components/updater/llupdatechecker.h +++ b/indra/viewer_components/updater/llupdatechecker.h @@ -29,6 +29,7 @@ #include +#include "llhttpclient.h" // // Implements asynchronous checking for updates. @@ -36,7 +37,36 @@ class LLUpdateChecker { public: class Client; - class Implementation; + class Implementation: + + public LLHTTPClient::Responder + { + public: + Implementation(Client & client); + ~Implementation(); + void checkVersion(std::string const & protocolVersion, std::string const & hostUrl, + std::string const & servicePath, std::string channel, std::string version); + + // Responder: + virtual void completed(U32 status, + const std::string & reason, + const LLSD& content); + virtual void error(U32 status, const std::string & reason); + + private: + static const char * sProtocolVersion; + + Client & mClient; + LLHTTPClient mHttpClient; + bool mInProgress; + std::string mVersion; + + std::string buildUrl(std::string const & protocolVersion, std::string const & hostUrl, + std::string const & servicePath, std::string channel, std::string version); + + LOG_CLASS(LLUpdateChecker::Implementation); + }; + // An exception that may be raised on check errors. class CheckError; @@ -48,7 +78,7 @@ public: std::string const & servicePath, std::string channel, std::string version); private: - boost::shared_ptr mImplementation; + LLPointer mImplementation; }; -- cgit v1.2.3 From 20e1f567d5c09df10fe120fde0d5f294eff0fff4 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Oct 2012 15:17:55 -0500 Subject: Fix for tests --- indra/llmessage/tests/llcurl_stub.cpp | 17 ----------------- indra/llmessage/tests/llhttpclient_test.cpp | 4 ++-- indra/newview/tests/lltranslate_test.cpp | 7 +------ 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/indra/llmessage/tests/llcurl_stub.cpp b/indra/llmessage/tests/llcurl_stub.cpp index d84fe0a49f..9b298d0c04 100644 --- a/indra/llmessage/tests/llcurl_stub.cpp +++ b/indra/llmessage/tests/llcurl_stub.cpp @@ -28,7 +28,6 @@ #include "llcurl.h" LLCurl::Responder::Responder() - : mReferenceCount(0) { } @@ -77,19 +76,3 @@ void LLCurl::Responder::result(LLSD const&) { } -namespace boost -{ - void intrusive_ptr_add_ref(LLCurl::Responder* p) - { - ++p->mReferenceCount; - } - - void intrusive_ptr_release(LLCurl::Responder* p) - { - if(p && 0 == --p->mReferenceCount) - { - delete p; - } - } -}; - diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp index 843c3bcc4b..a2be307cc8 100644 --- a/indra/llmessage/tests/llhttpclient_test.cpp +++ b/indra/llmessage/tests/llhttpclient_test.cpp @@ -189,9 +189,9 @@ namespace tut } public: - static boost::intrusive_ptr build(HTTPClientTestData& client) + static Result* build(HTTPClientTestData& client) { - return boost::intrusive_ptr(new Result(client)); + return new Result(client); } ~Result() diff --git a/indra/newview/tests/lltranslate_test.cpp b/indra/newview/tests/lltranslate_test.cpp index 10e37fae97..fd9527d631 100644 --- a/indra/newview/tests/lltranslate_test.cpp +++ b/indra/newview/tests/lltranslate_test.cpp @@ -299,11 +299,6 @@ LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker, const LLSD&, const F32) {} +void LLHTTPClient::get(const std::string&, LLPointer, const LLSD&, const F32) {} LLBufferStream::LLBufferStream(const LLChannelDescriptors& channels, LLBufferArray* buffer) : std::iostream(&mStreamBuf), mStreamBuf(channels, buffer) {} -- cgit v1.2.3 From 6b0fe3258a43159a0b2751cedae4d36bb9c09436 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Oct 2012 16:02:22 -0500 Subject: Fix for mac/linux build --- indra/llaudio/llaudiodecodemgr.cpp | 2 +- indra/llcommon/llthread.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index 6c97a64ed7..7768c3da0c 100644 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -690,7 +690,7 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) return FALSE; } -#if LL_DARWIN || LL_LINUX +#if LL_DARWIN // HACK: to fool the compiler into not emitting unused warnings. namespace { const ov_callbacks callback_array[4] = {OV_CALLBACKS_DEFAULT, OV_CALLBACKS_NOCLOSE, OV_CALLBACKS_STREAMONLY, diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 892e144911..115bf47553 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -234,7 +234,7 @@ protected: public: LLThreadSafeRefCount(); LLThreadSafeRefCount(const LLThreadSafeRefCount&); - LLThreadSafeRefCount&operator=(const LLThreadSafeRefCount& ref) + LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref) { if (sMutex) { @@ -245,6 +245,7 @@ public: { sMutex->unlock(); } + return *this; } -- cgit v1.2.3 From ce007b124b26b6d320b7164aca498bf9638388ae Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Oct 2012 16:32:09 -0500 Subject: Fix for linux build --- indra/llaudio/llaudiodecodemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index 7768c3da0c..6c97a64ed7 100644 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -690,7 +690,7 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) return FALSE; } -#if LL_DARWIN +#if LL_DARWIN || LL_LINUX // HACK: to fool the compiler into not emitting unused warnings. namespace { const ov_callbacks callback_array[4] = {OV_CALLBACKS_DEFAULT, OV_CALLBACKS_NOCLOSE, OV_CALLBACKS_STREAMONLY, -- cgit v1.2.3 From a5e28651f539ff0f9bb9a678538d70b5fa9f97ba Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 4 Oct 2012 20:12:37 -0400 Subject: tag merge of DRTVWR-222 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index cc02276c89..0ebf32ff47 100644 --- a/.hgtags +++ b/.hgtags @@ -311,3 +311,4 @@ ceed0b65a69f1eac20d523e0203320a32f9a3f3c DRTVWR-215 baa627938dbb7956f45e1eebef11ffe9e7f2e5bc 3.4.1-beta1 5adb2b8f96c3cac88ad7c7d996d707f1b29df336 3.4.1-beta1 b3f74858a1c8720c82d0978f3877a3fc8ba459ec 3.4.1-beta1a +f00068a66a2e2f72acbe3f690b98b323e740b289 DRTVWR-222 -- cgit v1.2.3