Sanity checks, bugfixes, crashfixes, and misc tweaks snagged from snowglobe.

This commit is contained in:
Shyotl
2011-03-01 20:13:05 -06:00
parent 8c0fb1261c
commit 30b1bd7abb
12 changed files with 142 additions and 74 deletions

View File

@@ -37,3 +37,10 @@
/* static */ /* static */
LLEditMenuHandler* LLEditMenuHandler::gEditMenuHandler = NULL; LLEditMenuHandler* LLEditMenuHandler::gEditMenuHandler = NULL;
LLEditMenuHandler::~LLEditMenuHandler()
{
if (gEditMenuHandler == this)
{
gEditMenuHandler = NULL;
}
}

View File

@@ -38,7 +38,7 @@ class LLEditMenuHandler
{ {
public: public:
// this is needed even though this is just an interface class. // this is needed even though this is just an interface class.
virtual ~LLEditMenuHandler() {}; virtual ~LLEditMenuHandler();
virtual void undo() {}; virtual void undo() {};
virtual BOOL canUndo() const { return FALSE; } virtual BOOL canUndo() const { return FALSE; }

View File

@@ -772,9 +772,11 @@ void LLFloater::snappedTo(const LLView* snap_view)
else else
{ {
//RN: assume it's a floater as it must be a sibling to our parent floater //RN: assume it's a floater as it must be a sibling to our parent floater
LLFloater* floaterp = (LLFloater*)snap_view; const LLFloater* floaterp = dynamic_cast<const LLFloater*>(snap_view);
if (floaterp)
setSnapTarget(floaterp->getHandle()); {
setSnapTarget(floaterp->getHandle());
}
} }
} }
@@ -1760,41 +1762,50 @@ void LLFloaterView::reshapeFloater(S32 width, S32 height, BOOL called_from_paren
// dependents use same follow flags as their "dependee" // dependents use same follow flags as their "dependee"
continue; continue;
} }
LLRect r = floaterp->getRect();
// Compute absolute distance from each edge of screen
S32 left_offset = llabs(r.mLeft - 0);
S32 right_offset = llabs(old_width - r.mRight);
S32 top_offset = llabs(old_height - r.mTop);
S32 bottom_offset = llabs(r.mBottom - 0);
// Make if follow the edge it is closest to // Make if follow the edge it is closest to
U32 follow_flags = 0x0; U32 follow_flags = 0x0;
if (left_offset < right_offset) if (floaterp->isMinimized())
{ {
follow_flags |= FOLLOWS_LEFT; follow_flags |= (FOLLOWS_LEFT | FOLLOWS_TOP);
} }
else else
{ {
follow_flags |= FOLLOWS_RIGHT; LLRect r = floaterp->getRect();
}
// "No vertical adjustment" usually means that the bottom of the view // Compute absolute distance from each edge of screen
// has been pushed up or down. Hence we want the floaters to follow S32 left_offset = llabs(r.mLeft - 0);
// the top. S32 right_offset = llabs(old_width - r.mRight);
if (!adjust_vertical)
{ S32 top_offset = llabs(old_height - r.mTop);
follow_flags |= FOLLOWS_TOP; S32 bottom_offset = llabs(r.mBottom - 0);
}
else if (top_offset < bottom_offset)
{ if (left_offset < right_offset)
follow_flags |= FOLLOWS_TOP; {
} follow_flags |= FOLLOWS_LEFT;
else }
{ else
follow_flags |= FOLLOWS_BOTTOM; {
follow_flags |= FOLLOWS_RIGHT;
}
// "No vertical adjustment" usually means that the bottom of the view
// has been pushed up or down. Hence we want the floaters to follow
// the top.
if (!adjust_vertical)
{
follow_flags |= FOLLOWS_TOP;
}
else if (top_offset < bottom_offset)
{
follow_flags |= FOLLOWS_TOP;
}
else
{
follow_flags |= FOLLOWS_BOTTOM;
}
} }
floaterp->setFollows(follow_flags); floaterp->setFollows(follow_flags);
@@ -2038,6 +2049,11 @@ void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus)
if (give_focus && !gFocusMgr.childHasKeyboardFocus(child)) if (give_focus && !gFocusMgr.childHasKeyboardFocus(child))
{ {
child->setFocus(TRUE); child->setFocus(TRUE);
// floater did not take focus, so relinquish focus to world
if (!child->hasFocus())
{
gFocusMgr.setKeyboardFocus(NULL);
}
} }
} }
@@ -2177,7 +2193,9 @@ void LLFloaterView::closeAllChildren(bool app_quitting)
// Attempt to close floater. This will cause the "do you want to save" // Attempt to close floater. This will cause the "do you want to save"
// dialogs to appear. // dialogs to appear.
if (floaterp->canClose() && !floaterp->isDead()) // Skip invisible floaters if we're not quitting (STORM-192).
if (floaterp->canClose() && !floaterp->isDead() &&
(app_quitting || floaterp->getVisible()))
{ {
floaterp->close(app_quitting); floaterp->close(app_quitting);
} }
@@ -2234,8 +2252,8 @@ void LLFloaterView::refresh()
// Constrain children to be entirely on the screen // Constrain children to be entirely on the screen
for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
{ {
LLFloater* floaterp = (LLFloater*)*child_it; LLFloater* floaterp = dynamic_cast<LLFloater*>(*child_it);
if( floaterp->getVisible() ) if (floaterp && floaterp->getVisible() )
{ {
// minimized floaters are kept fully onscreen // minimized floaters are kept fully onscreen
adjustToFitScreen(floaterp, !floaterp->isMinimized()); adjustToFitScreen(floaterp, !floaterp->isMinimized());
@@ -2255,7 +2273,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
// convert to local coordinate frame // convert to local coordinate frame
LLRect snap_rect_local = getLocalSnapRect(); LLRect snap_rect_local = getLocalSnapRect();
if( floater->isResizable() ) if( floater->isResizable() && !floater->isMinimized() )
{ {
LLRect view_rect = floater->getRect(); LLRect view_rect = floater->getRect();
S32 old_width = view_rect.getWidth(); S32 old_width = view_rect.getWidth();

View File

@@ -247,8 +247,13 @@ void LLView::sendChildToFront(LLView* child)
{ {
if (child && child->getParent() == this) if (child && child->getParent() == this)
{ {
mChildList.remove( child ); // minor optimization, but more importantly,
mChildList.push_front(child); // won't temporarily create an empty list
if (child != mChildList.front())
{
mChildList.remove( child );
mChildList.push_front(child);
}
} }
} }
@@ -256,8 +261,13 @@ void LLView::sendChildToBack(LLView* child)
{ {
if (child && child->getParent() == this) if (child && child->getParent() == this)
{ {
mChildList.remove( child ); // minor optimization, but more importantly,
mChildList.push_back(child); // won't temporarily create an empty list
if (child != mChildList.back())
{
mChildList.remove( child );
mChildList.push_back(child);
}
} }
} }
@@ -279,6 +289,10 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child)
void LLView::addChild(LLView* child, S32 tab_group) void LLView::addChild(LLView* child, S32 tab_group)
{ {
if (!child)
{
return;
}
if (mParentView == child) if (mParentView == child)
{ {
llerrs << "Adding view " << child->getName() << " as child of itself" << llendl; llerrs << "Adding view " << child->getName() << " as child of itself" << llendl;

View File

@@ -119,12 +119,12 @@ void LLViewQuery::filterChildren(LLView * view, viewList_t & filtered_children)
(*mSorterp)(view, views); // sort the children per the sorter (*mSorterp)(view, views); // sort the children per the sorter
} }
for(LLView::child_list_iter_t iter = views.begin(); for(LLView::child_list_iter_t iter = views.begin();
iter != views.end(); iter != views.end();
iter++) iter++)
{ {
viewList_t indiv_children = this->run(*iter); viewList_t indiv_children = this->run(*iter);
filtered_children.insert(filtered_children.end(), indiv_children.begin(), indiv_children.end()); filtered_children.splice(filtered_children.end(), indiv_children);
} }
} }
filterResult_t LLViewQuery::runFilters(LLView * view, const viewList_t children, const filterList_t filters) const filterResult_t LLViewQuery::runFilters(LLView * view, const viewList_t children, const filterList_t filters) const

View File

@@ -510,7 +510,8 @@ LLXmlTreeParser::LLXmlTreeParser(LLXmlTree* tree)
: mTree(tree), : mTree(tree),
mRoot( NULL ), mRoot( NULL ),
mCurrent( NULL ), mCurrent( NULL ),
mDump( FALSE ) mDump( FALSE ),
mKeepContents(FALSE)
{ {
} }

View File

@@ -53,7 +53,13 @@ LLAgentLanguage::LLAgentLanguage()
bool LLAgentLanguage::update() bool LLAgentLanguage::update()
{ {
LLSD body; LLSD body;
std::string url = gAgent.getRegion()->getCapability("UpdateAgentLanguage"); std::string url;
if (gAgent.getRegion())
{
url = gAgent.getRegion()->getCapability("UpdateAgentLanguage");
}
if (!url.empty()) if (!url.empty())
{ {
std::string language = LLUI::getLanguage(); std::string language = LLUI::getLanguage();

View File

@@ -129,6 +129,7 @@ void LLAssetUploadResponder::error(U32 statusNum, const std::string& reason)
break; break;
} }
LLUploadDialog::modalUploadFinished(); LLUploadDialog::modalUploadFinished();
LLFilePicker::instance().reset(); // unlock file picker when bulk upload fails
} }
//virtual //virtual

View File

@@ -328,16 +328,7 @@ void LLCloudLayer::setRegion(LLViewerRegion *regionp)
void LLCloudLayer::destroy() void LLCloudLayer::destroy()
{ {
// Kill all of the existing puffs reset();
S32 i, j;
for (i = 0; i < CLOUD_GROUPS_PER_EDGE; i++)
{
for (j = 0; j < CLOUD_GROUPS_PER_EDGE; j++)
{
mCloudGroups[i][j].cleanup();
}
}
delete [] mDensityp; delete [] mDensityp;
mDensityp = NULL; mDensityp = NULL;
@@ -347,8 +338,17 @@ void LLCloudLayer::destroy()
void LLCloudLayer::reset() void LLCloudLayer::reset()
{ {
} // Kill all of the existing puffs
S32 i, j;
for (i = 0; i < CLOUD_GROUPS_PER_EDGE; i++)
{
for (j = 0; j < CLOUD_GROUPS_PER_EDGE; j++)
{
mCloudGroups[i][j].cleanup();
}
}
}
void LLCloudLayer::setWindPointer(LLWind *windp) void LLCloudLayer::setWindPointer(LLWind *windp)
{ {

View File

@@ -193,6 +193,9 @@ BOOL LLColorSwatchCtrl::handleMouseUp(S32 x, S32 y, MASK mask)
llassert(getEnabled()); llassert(getEnabled());
llassert(getVisible()); llassert(getVisible());
// Focus the widget now in order to return the focus
// after the color picker is closed.
setFocus(TRUE);
showPicker(FALSE); showPicker(FALSE);
} }
} }

View File

@@ -115,9 +115,12 @@ void LLDrawPoolTree::render(S32 pass)
iter != mDrawFace.end(); iter++) iter != mDrawFace.end(); iter++)
{ {
LLFace *face = *iter; LLFace *face = *iter;
face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK); if(face->mVertexBuffer.notNull())
face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0); {
gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices()/3); face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0);
gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices());
}
} }
} }
} }

View File

@@ -846,7 +846,8 @@ void LLGroupMgr::clearGroupData(const LLUUID& group_id)
void LLGroupMgr::addObserver(LLGroupMgrObserver* observer) void LLGroupMgr::addObserver(LLGroupMgrObserver* observer)
{ {
mObservers.insert(std::pair<LLUUID, LLGroupMgrObserver*>(observer->getID(), observer)); if( observer->getID() != LLUUID::null )
mObservers.insert(std::pair<LLUUID, LLGroupMgrObserver*>(observer->getID(), observer));
} }
void LLGroupMgr::removeObserver(LLGroupMgrObserver* observer) void LLGroupMgr::removeObserver(LLGroupMgrObserver* observer)
@@ -1193,8 +1194,8 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data)
} }
else else
{ {
if (!rd) llwarns << "Received role data for unkown role " << role_id << " in group " << group_id << llendl; if (!rd) llwarns << "Received role data for unknown role " << role_id << " in group " << group_id << llendl;
if (!md) llwarns << "Received role data for unkown member " << member_id << " in group " << group_id << llendl; if (!md) llwarns << "Received role data for unknown member " << member_id << " in group " << group_id << llendl;
} }
} }
} }
@@ -1402,11 +1403,17 @@ void LLGroupMgr::notifyObservers(LLGroupChange gc)
{ {
for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end(); ++gi) for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end(); ++gi)
{ {
LLUUID group_id = gi->first;
if (gi->second->mChanged) if (gi->second->mChanged)
{ {
// notify LLGroupMgrObserver
// Copy the map because observers may remove themselves on update
observer_multimap_t observers = mObservers;
// find all observers for this group id // find all observers for this group id
observer_multimap_t::iterator oi = mObservers.find(gi->first); observer_multimap_t::iterator oi = observers.lower_bound(group_id);
for (; oi != mObservers.end(); ++oi) observer_multimap_t::iterator end = observers.upper_bound(group_id);
for (; oi != end; ++oi)
{ {
oi->second->changed(gc); oi->second->changed(gc);
} }
@@ -1751,11 +1758,13 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
for (std::vector<LLUUID>::iterator it = member_ids.begin(); for (std::vector<LLUUID>::iterator it = member_ids.begin();
it != member_ids.end(); ++it) it != member_ids.end(); ++it)
{ {
LLUUID& ejected_member_id = (*it);
// Can't use 'eject' to leave a group. // Can't use 'eject' to leave a group.
if ((*it) == gAgent.getID()) continue; if (ejected_member_id == gAgent.getID()) continue;
// Make sure they are in the group, and we need the member data // Make sure they are in the group, and we need the member data
LLGroupMgrGroupData::member_list_t::iterator mit = group_datap->mMembers.find(*it); LLGroupMgrGroupData::member_list_t::iterator mit = group_datap->mMembers.find(ejected_member_id);
if (mit != group_datap->mMembers.end()) if (mit != group_datap->mMembers.end())
{ {
// Add them to the message // Add them to the message
@@ -1771,7 +1780,7 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
} }
msg->nextBlock("EjectData"); msg->nextBlock("EjectData");
msg->addUUID("EjecteeID",(*it)); msg->addUUID("EjecteeID",ejected_member_id);
if (msg->isSendFull()) if (msg->isSendFull())
{ {
@@ -1779,17 +1788,23 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
start_message = true; start_message = true;
} }
LLGroupMemberData* member_data = (*mit).second;
// Clean up groupmgr // Clean up groupmgr
for (LLGroupMemberData::role_list_t::iterator rit = (*mit).second->roleBegin(); for (LLGroupMemberData::role_list_t::iterator rit = member_data->roleBegin();
rit != (*mit).second->roleEnd(); ++rit) rit != member_data->roleEnd(); ++rit)
{ {
if ((*rit).first.notNull()) if ((*rit).first.notNull() && (*rit).second!=0)
{ {
(*rit).second->removeMember(*it); (*rit).second->removeMember(ejected_member_id);
} }
} }
delete (*mit).second;
group_datap->mMembers.erase(*it); group_datap->mMembers.erase(ejected_member_id);
// member_data was introduced and is used here instead of (*mit).second to avoid crash because of invalid iterator
// It becomes invalid after line with erase above. EXT-4778
delete member_data;
} }
} }