diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-01-30 11:10:53 -0800 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-01-30 11:10:53 -0800 |
commit | 588dc1b020315ca2c62eb8adc0db48af61e55c4e (patch) | |
tree | 3b8b95df3c68208b47d578a1fda4961c97e13a57 /indra | |
parent | 00693fc728ac2739d896558bc4387374e7030b63 (diff) |
PATH-187: Using handles instead of pointers for safer implementation.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.cpp | 58 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.h | 53 |
2 files changed, 66 insertions, 45 deletions
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index e2846d36f3..571c4a8427 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -32,7 +32,7 @@ #include "v3math.h"
#include "lltextvalidate.h"
#include "llagent.h"
-#include "llfloater.h"
+#include "llhandle.h"
#include "llfloaterreg.h"
#include "lltextbase.h"
#include "lllineeditor.h"
@@ -59,7 +59,8 @@ class NavMeshDataGetResponder : public LLHTTPClient::Responder
{
public:
- NavMeshDataGetResponder(const std::string& pNavMeshDataGetURL, LLFloaterPathfindingLinksets *pLinksetsFloater);
+ NavMeshDataGetResponder(const std::string& pNavMeshDataGetURL,
+ const LLHandle<LLFloaterPathfindingLinksets> &pLinksetsHandle);
virtual ~NavMeshDataGetResponder();
virtual void result(const LLSD& pContent);
@@ -68,8 +69,8 @@ public: private:
NavMeshDataGetResponder(const NavMeshDataGetResponder& pOther);
- std::string mNavMeshDataGetURL;
- LLFloaterPathfindingLinksets *mLinksetsFloater;
+ std::string mNavMeshDataGetURL;
+ LLHandle<LLFloaterPathfindingLinksets> mLinksetsFloaterHandle;
};
//---------------------------------------------------------------------------
@@ -79,7 +80,8 @@ private: class NavMeshDataPutResponder : public LLHTTPClient::Responder
{
public:
- NavMeshDataPutResponder(const std::string& pNavMeshDataPutURL, LLFloaterPathfindingLinksets *pLinksetsFloater);
+ NavMeshDataPutResponder(const std::string& pNavMeshDataPutURL,
+ const LLHandle<LLFloaterPathfindingLinksets> &pLinksetsHandle);
virtual ~NavMeshDataPutResponder();
virtual void result(const LLSD& pContent);
@@ -88,8 +90,8 @@ public: private:
NavMeshDataPutResponder(const NavMeshDataPutResponder& pOther);
- std::string mNavMeshDataPutURL;
- LLFloaterPathfindingLinksets *mLinksetsFloater;
+ std::string mNavMeshDataPutURL;
+ LLHandle<LLFloaterPathfindingLinksets> mLinksetsFloaterHandle;
};
//---------------------------------------------------------------------------
@@ -232,6 +234,7 @@ BOOL LLFloaterPathfindingLinksets::isMessagingInProgress() const LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed)
: LLFloater(pSeed),
+ mSelfHandle(),
mPathfindingLinksets(),
mMessagingState(kMessagingInitial),
mLinksetsScrollList(NULL),
@@ -257,6 +260,7 @@ LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed) mEditPhantom(NULL),
mApplyEdits(NULL)
{
+ mSelfHandle.bind(this);
}
LLFloaterPathfindingLinksets::~LLFloaterPathfindingLinksets()
@@ -287,7 +291,7 @@ void LLFloaterPathfindingLinksets::sendNavMeshDataGetRequest() else
{
setMessagingState(kMessagingFetchRequestSent);
- LLHTTPClient::get(navMeshDataURL, new NavMeshDataGetResponder(navMeshDataURL, this));
+ LLHTTPClient::get(navMeshDataURL, new NavMeshDataGetResponder(navMeshDataURL, mSelfHandle));
}
}
}
@@ -303,7 +307,7 @@ void LLFloaterPathfindingLinksets::sendNavMeshDataPutRequest(const LLSD& pPostDa }
else
{
- LLHTTPClient::put(navMeshDataURL, pPostData, new NavMeshDataPutResponder(navMeshDataURL, this));
+ LLHTTPClient::put(navMeshDataURL, pPostData, new NavMeshDataPutResponder(navMeshDataURL, mSelfHandle));
}
}
}
@@ -756,48 +760,64 @@ void LLFloaterPathfindingLinksets::setPathState(LLPathfindingLinkset::EPathState // NavMeshDataGetResponder
//---------------------------------------------------------------------------
-NavMeshDataGetResponder::NavMeshDataGetResponder(const std::string& pNavMeshDataGetURL, LLFloaterPathfindingLinksets *pLinksetsFloater)
+NavMeshDataGetResponder::NavMeshDataGetResponder(const std::string& pNavMeshDataGetURL,
+ const LLHandle<LLFloaterPathfindingLinksets> &pLinksetsHandle)
: mNavMeshDataGetURL(pNavMeshDataGetURL),
- mLinksetsFloater(pLinksetsFloater)
+ mLinksetsFloaterHandle(pLinksetsHandle)
{
}
NavMeshDataGetResponder::~NavMeshDataGetResponder()
{
- mLinksetsFloater = NULL;
}
void NavMeshDataGetResponder::result(const LLSD& pContent)
{
- mLinksetsFloater->handleNavMeshDataGetReply(pContent);
+ LLFloaterPathfindingLinksets *linksetsFloater = mLinksetsFloaterHandle.get();
+ if (linksetsFloater != NULL)
+ {
+ linksetsFloater->handleNavMeshDataGetReply(pContent);
+ }
}
void NavMeshDataGetResponder::error(U32 status, const std::string& reason)
{
- mLinksetsFloater->handleNavMeshDataGetError(mNavMeshDataGetURL, reason);
+ LLFloaterPathfindingLinksets *linksetsFloater = mLinksetsFloaterHandle.get();
+ if (linksetsFloater != NULL)
+ {
+ linksetsFloater->handleNavMeshDataGetError(mNavMeshDataGetURL, reason);
+ }
}
//---------------------------------------------------------------------------
// NavMeshDataPutResponder
//---------------------------------------------------------------------------
-NavMeshDataPutResponder::NavMeshDataPutResponder(const std::string& pNavMeshDataPutURL, LLFloaterPathfindingLinksets *pLinksetsFloater)
+NavMeshDataPutResponder::NavMeshDataPutResponder(const std::string& pNavMeshDataPutURL,
+ const LLHandle<LLFloaterPathfindingLinksets> &pLinksetsHandle)
: mNavMeshDataPutURL(pNavMeshDataPutURL),
- mLinksetsFloater(pLinksetsFloater)
+ mLinksetsFloaterHandle(pLinksetsHandle)
{
}
NavMeshDataPutResponder::~NavMeshDataPutResponder()
{
- mLinksetsFloater = NULL;
}
void NavMeshDataPutResponder::result(const LLSD& pContent)
{
- mLinksetsFloater->handleNavMeshDataPutReply(pContent);
+ LLFloaterPathfindingLinksets *linksetsFloater = mLinksetsFloaterHandle.get();
+ if (linksetsFloater != NULL)
+ {
+ linksetsFloater->handleNavMeshDataPutReply(pContent);
+ }
}
void NavMeshDataPutResponder::error(U32 status, const std::string& reason)
{
- mLinksetsFloater->handleNavMeshDataPutError(mNavMeshDataPutURL, reason);
+ LLFloaterPathfindingLinksets *linksetsFloater = mLinksetsFloaterHandle.get();
+ if (linksetsFloater != NULL)
+ {
+ linksetsFloater->handleNavMeshDataPutError(mNavMeshDataPutURL, reason);
+ }
}
diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index bb37987160..250625c72a 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -28,13 +28,13 @@ #ifndef LL_LLFLOATERPATHFINDINGLINKSETS_H
#define LL_LLFLOATERPATHFINDINGLINKSETS_H
-#include "llsd.h"
-#include "v3math.h"
+#include "llhandle.h"
#include "llfloater.h"
#include "lluuid.h"
#include "llpathfindinglinkset.h"
#include "llfilteredpathfindinglinksets.h"
+class LLSD;
class LLTextBase;
class LLScrollListCtrl;
class LLLineEditor;
@@ -76,30 +76,31 @@ public: protected:
private:
- LLFilteredPathfindingLinksets mPathfindingLinksets;
- EMessagingState mMessagingState;
- LLScrollListCtrl *mLinksetsScrollList;
- LLTextBase *mLinksetsStatus;
- LLLineEditor *mFilterByName;
- LLLineEditor *mFilterByDescription;
- LLCheckBoxCtrl *mFilterByWalkable;
- LLCheckBoxCtrl *mFilterByObstacle;
- LLCheckBoxCtrl *mFilterByIgnored;
- LLRadioGroup *mEditPathState;
- LLUICtrl *mEditPathStateWalkable;
- LLUICtrl *mEditPathStateObstacle;
- LLUICtrl *mEditPathStateIgnored;
- LLTextBase *mLabelWalkabilityCoefficients;
- LLTextBase *mLabelEditA;
- LLTextBase *mLabelEditB;
- LLTextBase *mLabelEditC;
- LLTextBase *mLabelEditD;
- LLLineEditor *mEditA;
- LLLineEditor *mEditB;
- LLLineEditor *mEditC;
- LLLineEditor *mEditD;
- LLCheckBoxCtrl *mEditPhantom;
- LLButton *mApplyEdits;
+ LLRootHandle<LLFloaterPathfindingLinksets> mSelfHandle;
+ LLFilteredPathfindingLinksets mPathfindingLinksets;
+ EMessagingState mMessagingState;
+ LLScrollListCtrl *mLinksetsScrollList;
+ LLTextBase *mLinksetsStatus;
+ LLLineEditor *mFilterByName;
+ LLLineEditor *mFilterByDescription;
+ LLCheckBoxCtrl *mFilterByWalkable;
+ LLCheckBoxCtrl *mFilterByObstacle;
+ LLCheckBoxCtrl *mFilterByIgnored;
+ LLRadioGroup *mEditPathState;
+ LLUICtrl *mEditPathStateWalkable;
+ LLUICtrl *mEditPathStateObstacle;
+ LLUICtrl *mEditPathStateIgnored;
+ LLTextBase *mLabelWalkabilityCoefficients;
+ LLTextBase *mLabelEditA;
+ LLTextBase *mLabelEditB;
+ LLTextBase *mLabelEditC;
+ LLTextBase *mLabelEditD;
+ LLLineEditor *mEditA;
+ LLLineEditor *mEditB;
+ LLLineEditor *mEditC;
+ LLLineEditor *mEditD;
+ LLCheckBoxCtrl *mEditPhantom;
+ LLButton *mApplyEdits;
// Does its own instance management, so clients not allowed
// to allocate or destroy.
|