summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2010-02-05 12:12:46 +0200
committerMike Antipov <mantipov@productengine.com>2010-02-05 12:12:46 +0200
commit7160c508bfff854ff7d44e8043763a1af0817f16 (patch)
tree9f32a6821d942fd3980200610ffd627271673b73 /indra/newview
parentf60afe790b156051f1da72abea2ea64731c704ac (diff)
Fixed critical bug EXT-4947 (Viewer crashes after 'See my online status' check-box was checked for deleted from friends avatar)
- added updating of allowed rights when friendship is terminated/started to disable/enable checkboxes - also added validation of avatar's relationship before committing and log a warning if it is absent. --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelavatar.cpp32
-rw-r--r--indra/newview/llpanelavatar.h5
2 files changed, 27 insertions, 10 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 4a7cdfc856..d7c558d188 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -196,10 +196,9 @@ void LLPanelAvatarNotes::fillRightsData()
childSetValue("map_check",LLRelationship::GRANT_MAP_LOCATION & rights ? TRUE : FALSE);
childSetValue("objects_check",LLRelationship::GRANT_MODIFY_OBJECTS & rights ? TRUE : FALSE);
- childSetEnabled("status_check",TRUE);
- childSetEnabled("map_check",TRUE);
- childSetEnabled("objects_check",TRUE);
}
+
+ enableCheckboxes(NULL != relation);
}
void LLPanelAvatarNotes::onCommitNotes()
@@ -250,6 +249,17 @@ void LLPanelAvatarNotes::confirmModifyRights(bool grant, S32 rights)
void LLPanelAvatarNotes::onCommitRights()
{
+ const LLRelationship* buddy_relationship =
+ LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
+
+ if (NULL == buddy_relationship)
+ {
+ // Lets have a warning log message instead of having a crash. EXT-4947.
+ llwarns << "Trying to modify rights for non-friend avatar. Skipped." << llendl;
+ return;
+ }
+
+
S32 rights = 0;
if(childGetValue("status_check").asBoolean())
@@ -259,8 +269,6 @@ void LLPanelAvatarNotes::onCommitRights()
if(childGetValue("objects_check").asBoolean())
rights |= LLRelationship::GRANT_MODIFY_OBJECTS;
- const LLRelationship* buddy_relationship =
- LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
bool allow_modify_objects = childGetValue("objects_check").asBoolean();
// if modify objects checkbox clicked
@@ -304,9 +312,7 @@ void LLPanelAvatarNotes::resetControls()
//Disable "Add Friend" button for friends.
childSetEnabled("add_friend", TRUE);
- childSetEnabled("status_check",FALSE);
- childSetEnabled("map_check",FALSE);
- childSetEnabled("objects_check",FALSE);
+ enableCheckboxes(false);
}
void LLPanelAvatarNotes::onAddFriendButtonClick()
@@ -334,6 +340,13 @@ void LLPanelAvatarNotes::onShareButtonClick()
//*TODO not implemented.
}
+void LLPanelAvatarNotes::enableCheckboxes(bool enable)
+{
+ childSetEnabled("status_check", enable);
+ childSetEnabled("map_check", enable);
+ childSetEnabled("objects_check", enable);
+}
+
LLPanelAvatarNotes::~LLPanelAvatarNotes()
{
if(getAvatarId().notNull())
@@ -348,6 +361,9 @@ LLPanelAvatarNotes::~LLPanelAvatarNotes()
void LLPanelAvatarNotes::changed(U32 mask)
{
childSetEnabled("teleport", LLAvatarTracker::instance().isBuddyOnline(getAvatarId()));
+
+ // update rights to avoid have checkboxes enabled when friendship is terminated. EXT-4947.
+ fillRightsData();
}
// virtual
diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h
index 632590aa27..52b4255e34 100644
--- a/indra/newview/llpanelavatar.h
+++ b/indra/newview/llpanelavatar.h
@@ -259,8 +259,8 @@ private:
};
/**
-* Panel for displaying Avatar's notes and modifying friend's rights.
-*/
+ * Panel for displaying Avatar's notes and modifying friend's rights.
+ */
class LLPanelAvatarNotes
: public LLPanelProfileTab
, public LLFriendObserver
@@ -311,6 +311,7 @@ protected:
void onCallButtonClick();
void onTeleportButtonClick();
void onShareButtonClick();
+ void enableCheckboxes(bool enable);
};
#endif // LL_LLPANELAVATAR_H