Skip to content

Commit 9f47542

Browse files
committed
#3265 Crash at getAllowEnvironmentOverride
Check region pointer and make sure external callbacks get disconected
1 parent 0dda1b0 commit 9f47542

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

indra/newview/llfloaterregioninfo.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,8 +2100,14 @@ LLPanelEstateInfo::LLPanelEstateInfo()
21002100
mEstateID(0) // invalid
21012101
{
21022102
LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
2103-
estate_info.setCommitCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
2104-
estate_info.setUpdateCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
2103+
mEstateInfoCommitConnection = estate_info.setCommitCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
2104+
mEstateInfoUpdateConnection = estate_info.setUpdateCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this));
2105+
}
2106+
2107+
LLPanelEstateInfo::~LLPanelEstateInfo()
2108+
{
2109+
mEstateInfoCommitConnection.disconnect();
2110+
mEstateInfoUpdateConnection.disconnect();
21052111
}
21062112

21072113
// static

indra/newview/llfloaterregioninfo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class LLPanelEstateInfo : public LLPanelRegionInfo
320320
bool onMessageCommit(const LLSD& notification, const LLSD& response);
321321

322322
LLPanelEstateInfo();
323-
~LLPanelEstateInfo() {}
323+
~LLPanelEstateInfo();
324324

325325
void updateControls(LLViewerRegion* region);
326326

@@ -352,6 +352,8 @@ class LLPanelEstateInfo : public LLPanelRegionInfo
352352
bool checkSunHourSlider(LLUICtrl* child_ctrl);
353353

354354
U32 mEstateID;
355+
boost::signals2::connection mEstateInfoCommitConnection;
356+
boost::signals2::connection mEstateInfoUpdateConnection;
355357
};
356358

357359
/////////////////////////////////////////////////////////////////////////////

indra/newview/llpanelenvironment.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,14 @@ void LLPanelEnvironmentInfo::refresh()
359359

360360
void LLPanelEnvironmentInfo::refreshFromEstate()
361361
{
362-
LLViewerRegion *pRegion = gAgent.getRegion();
363-
364-
bool oldAO = mAllowOverride;
365-
mAllowOverride = (isRegion() && LLEstateInfoModel::instance().getAllowEnvironmentOverride()) || pRegion->getAllowEnvironmentOverride();
366-
if (oldAO != mAllowOverride)
367-
refresh();
362+
LLViewerRegion* pRegion = gAgent.getRegion();
363+
if (pRegion)
364+
{
365+
bool oldAO = mAllowOverride;
366+
mAllowOverride = (isRegion() && LLEstateInfoModel::instance().getAllowEnvironmentOverride()) || pRegion->getAllowEnvironmentOverride();
367+
if (oldAO != mAllowOverride)
368+
refresh();
369+
}
368370
}
369371

370372
std::string LLPanelEnvironmentInfo::getNameForTrackIndex(U32 index)

0 commit comments

Comments
 (0)