Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent erroneous edit of wrong parcel #3129

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions indra/llinventory/llparcel.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ class LLParcel

void setMediaURLResetTimer(F32 time);
virtual void setLocalID(S32 local_id);
void setRegionID(const LLUUID& id) { mRegionID = id; }
const LLUUID& getRegionID() const { return mRegionID; }

// blow away all the extra stuff lurking in parcels, including urls, access lists, etc
void clearParcel();
Expand Down Expand Up @@ -651,6 +653,7 @@ class LLParcel
S32 mLocalID;
LLUUID mBanListTransactionID;
LLUUID mAccessListTransactionID;
LLUUID mRegionID;
std::map<LLUUID,LLAccessEntry> mAccessList;
std::map<LLUUID,LLAccessEntry> mBanList;
std::map<LLUUID,LLAccessEntry> mTempBanList;
Expand Down
12 changes: 9 additions & 3 deletions indra/newview/llviewerparcelmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1327,12 +1327,12 @@ const S32 LLViewerParcelMgr::getAgentParcelId() const
return INVALID_PARCEL_ID;
}

void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_agent_region)
void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel)
{
if(!parcel)
return;

LLViewerRegion *region = use_agent_region ? gAgent.getRegion() : LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth );
LLViewerRegion *region = LLWorld::getInstance()->getRegionFromID(parcel->getRegionID());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the bug lived. The region pointer was being found based on (a) whether the agent was in the region or (b) a cached value of mWestSouth which was supposed to be the global-position of the region's origin corner, but could sometimes be from the wrong region.

The fix is to cache the region_id in each parcel so it can be used to find the region in this context.

if (!region)
return;

Expand Down Expand Up @@ -1676,10 +1676,16 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
// Actually extract the data.
if (parcel)
{
// store region_id in the parcel so we can find it again later
LLViewerRegion* parcel_region = LLWorld::getInstance()->getRegion(msg->getSender());
if (parcel_region)
{
parcel->setRegionID(parcel_region->getRegionID());
}

if (local_id == parcel_mgr.mAgentParcel->getLocalID())
{
// Parcels in different regions can have same ids.
LLViewerRegion* parcel_region = LLWorld::getInstance()->getRegion(msg->getSender());
LLViewerRegion* agent_region = gAgent.getRegion();
if (parcel_region && agent_region && parcel_region->getRegionID() == agent_region->getRegionID())
{
Expand Down
2 changes: 1 addition & 1 deletion indra/newview/llviewerparcelmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class LLViewerParcelMgr : public LLSingleton<LLViewerParcelMgr>
// containing the southwest corner of the selection.
// If want_reply_to_update, simulator will send back a ParcelProperties
// message.
void sendParcelPropertiesUpdate(LLParcel* parcel, bool use_agent_region = false);
void sendParcelPropertiesUpdate(LLParcel* parcel);

// Takes an Access List flag, like AL_ACCESS or AL_BAN
void sendParcelAccessListUpdate(U32 which);
Expand Down
Loading