From b8e954f98d37cb8e045135dd6bbaab9fc4421529 Mon Sep 17 00:00:00 2001 From: Merov Linden <merov@lindenlab.com> Date: Wed, 19 Oct 2011 14:09:58 -0700 Subject: [PATCH] EXP-1353, EXP-1408, EXP-1410 : Fix bugs all related to Teleport History management. Note to dev: some use of boost trckable are being deprecated for thread safety so disconnect established connections in destructors. Also beware of singleton depending on each other as they are lazily instantiated. --- indra/newview/llpanelteleporthistory.cpp | 1 + indra/newview/llteleporthistory.cpp | 9 +++++++-- indra/newview/llteleporthistory.h | 3 +++ indra/newview/llteleporthistorystorage.h | 6 +++--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 2c3f76f5462..d3543daff08 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -389,6 +389,7 @@ LLTeleportHistoryPanel::~LLTeleportHistoryPanel() { LLTeleportHistoryFlatItemStorage::instance().purge(); delete mGearMenuHandle.get(); + mTeleportHistoryChangedConnection.disconnect(); } BOOL LLTeleportHistoryPanel::postBuild() diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp index 0d8b45db1fe..50a088b7997 100644 --- a/indra/newview/llteleporthistory.cpp +++ b/indra/newview/llteleporthistory.cpp @@ -56,7 +56,8 @@ const std::string& LLTeleportHistoryItem::getTitle() const LLTeleportHistory::LLTeleportHistory(): mCurrentItem(-1), mRequestedItem(-1), - mGotInitialUpdate(false) + mGotInitialUpdate(false), + mTeleportHistoryStorage(NULL) { mTeleportFinishedConn = LLViewerParcelMgr::getInstance()-> setTeleportFinishedCallback(boost::bind(&LLTeleportHistory::updateCurrentLocation, this, _1)); @@ -115,6 +116,10 @@ void LLTeleportHistory::handleLoginComplete() void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos) { + if (!mTeleportHistoryStorage) + { + mTeleportHistoryStorage = LLTeleportHistoryStorage::getInstance(); + } if (mRequestedItem != -1) // teleport within the history in progress? { mCurrentItem = mRequestedItem; @@ -152,7 +157,7 @@ void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos) if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check { llwarns << "Invalid current item. (this should not happen)" << llendl; - llassert(!"Invalid current teleport histiry item"); + llassert(!"Invalid current teleport history item"); return; } LLVector3 new_pos_local = gAgent.getPosAgentFromGlobal(new_pos); diff --git a/indra/newview/llteleporthistory.h b/indra/newview/llteleporthistory.h index e45dc28f9b4..e9c29c39bf3 100644 --- a/indra/newview/llteleporthistory.h +++ b/indra/newview/llteleporthistory.h @@ -33,6 +33,7 @@ #include <string> #include <boost/function.hpp> #include <boost/signals2.hpp> +#include "llteleporthistorystorage.h" /** @@ -210,6 +211,8 @@ class LLTeleportHistory: public LLSingleton<LLTeleportHistory> */ bool mGotInitialUpdate; + LLTeleportHistoryStorage* mTeleportHistoryStorage; + /** * Signal emitted when the history gets changed. * diff --git a/indra/newview/llteleporthistorystorage.h b/indra/newview/llteleporthistorystorage.h index 6cae0a34547..cf4c85a9910 100644 --- a/indra/newview/llteleporthistorystorage.h +++ b/indra/newview/llteleporthistorystorage.h @@ -93,9 +93,6 @@ class LLTeleportHistoryStorage: public LLSingleton<LLTeleportHistoryStorage> void removeItem(S32 idx); void save(); - void load(); - - void dump() const; /** * Set a callback to be called upon history changes. @@ -113,6 +110,9 @@ class LLTeleportHistoryStorage: public LLSingleton<LLTeleportHistoryStorage> private: + void load(); + void dump() const; + void onTeleportHistoryChange(); bool compareByTitleAndGlobalPos(const LLTeleportHistoryPersistentItem& a, const LLTeleportHistoryPersistentItem& b); -- GitLab