Skip to content
Snippets Groups Projects
Commit 7160c508 authored by Mike Antipov's avatar Mike Antipov
Browse files

Fixed critical bug EXT-4947 (Viewer crashes after 'See my online status'...

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
parent f60afe79
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -259,8 +259,8 @@ class LLPanelMyProfile
};
/**
* 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 @@ class LLPanelAvatarNotes
void onCallButtonClick();
void onTeleportButtonClick();
void onShareButtonClick();
void enableCheckboxes(bool enable);
};
#endif // LL_LLPANELAVATAR_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment