diff options
author | Merov Linden <merov@lindenlab.com> | 2012-10-25 18:16:56 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-10-25 18:16:56 -0700 |
commit | d49de3a66a5476f4541f15dc61c68e0e509c4c70 (patch) | |
tree | 7b1245ccbc660130e7973999af04acbb1d19349c | |
parent | b5d76c2b55666083279580f383e5a7b139517504 (diff) |
CHUI-441 : WIP : Fix crashes when spawning torn off floaters, added widgets creation in the torn off floater for participants.
-rwxr-xr-x | indra/llui/llfolderviewitem.cpp | 6 | ||||
-rwxr-xr-x | indra/llui/llfolderviewitem.h | 2 | ||||
-rw-r--r-- | indra/llui/llfolderviewmodel.h | 5 | ||||
-rwxr-xr-x | indra/newview/llconversationview.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llimconversation.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llimconversation.h | 2 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 29 |
7 files changed, 39 insertions, 29 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 0b04288950..099d51ce17 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -169,7 +169,6 @@ BOOL LLFolderViewItem::postBuild() // Destroys the object LLFolderViewItem::~LLFolderViewItem( void ) { - delete mViewModelItem; mViewModelItem = NULL; } @@ -473,8 +472,9 @@ void LLFolderViewItem::rename(const std::string& new_name) const std::string& LLFolderViewItem::getName( void ) const { - return getViewModelItem()->getName(); - } + static const std::string noName(""); + return getViewModelItem() ? getViewModelItem()->getName() : noName; +} // LLView functionality BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index d4002c3184..19a6b0a44a 100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -87,7 +87,7 @@ protected: bool mLabelWidthDirty; S32 mLabelPaddingRight; LLFolderViewFolder* mParentFolder; - LLFolderViewModelItem* mViewModelItem; + LLPointer<LLFolderViewModelItem> mViewModelItem; LLFontGL::StyleFlags mLabelStyle; std::string mLabelSuffix; LLUIImagePtr mIcon, diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index c6030c9b71..5ec08ae211 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -129,10 +129,11 @@ public: // This is am abstract base class that users of the folderview classes // would use to bridge the folder view with the underlying data -class LLFolderViewModelItem +class LLFolderViewModelItem : public LLRefCount { public: - virtual ~LLFolderViewModelItem( void ) {}; + LLFolderViewModelItem() { } + virtual ~LLFolderViewModelItem() { } virtual void update() {} //called when drawing virtual const std::string& getName() const = 0; diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 9144f402b4..2d5665190f 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -234,9 +234,9 @@ void LLConversationViewSession::toggleOpen() void LLConversationViewSession::selectItem() { - - LLConversationItem* item = dynamic_cast<LLConversationItem*>(mViewModelItem); - LLFloater* session_floater = LLIMConversation::getConversation(item->getUUID()); + LLFolderViewModelItem* item = mViewModelItem; + LLUUID session_uuid = dynamic_cast<LLConversationItem*>(item)->getUUID(); + LLFloater* session_floater = LLIMConversation::getConversation(session_uuid); LLMultiFloater* host_floater = session_floater->getHost(); if (host_floater == mContainer) @@ -250,7 +250,7 @@ void LLConversationViewSession::selectItem() // Set the focus on the selected floater session_floater->setFocus(TRUE); // Store the active session - LLIMFloaterContainer::getInstance()->setSelectedSession(item->getUUID()); + LLIMFloaterContainer::getInstance()->setSelectedSession(session_uuid); LLFolderViewItem::selectItem(); @@ -272,8 +272,9 @@ void LLConversationViewSession::setVisibleIfDetached(BOOL visible) { // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here - LLConversationItem* item = dynamic_cast<LLConversationItem*>(mViewModelItem); - LLFloater* session_floater = LLIMConversation::getConversation(item->getUUID()); + LLFolderViewModelItem* item = mViewModelItem; + LLUUID session_uuid = dynamic_cast<LLConversationItem*>(item)->getUUID(); + LLFloater* session_floater = LLIMConversation::getConversation(session_uuid); if (session_floater && !session_floater->getHost() && !session_floater->isMinimized()) { diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index 1e268bcaf9..532f1be6a8 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -351,6 +351,17 @@ void LLIMConversation::buildParticipantList() //updateHeaderAndToolbar(); } +void LLIMConversation::addConversationViewParticipant(LLConversationItem* participant_model) +{ + // Check if the model already has an associated view + llinfos << "Merov debug : addConversationViewParticipant(). We need to check the existence!!!" << llendl; + + // Create the participant view and attach it to the root + LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model); + participant_view->addToFolder(mConversationsRoot); // ! Not sure about that. TBC... + participant_view->setVisible(TRUE); +} + // Copied from LLIMFloaterContainer::createConversationViewParticipant(). Refactor opportunity! LLConversationViewParticipant* LLIMConversation::createConversationViewParticipant(LLConversationItem* item) { diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index c3f885c8be..09d0016946 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -71,6 +71,8 @@ public: /*virtual*/ void onClose(bool app_quitting); /*virtual*/ BOOL postBuild(); /*virtual*/ void draw(); + + void addConversationViewParticipant(LLConversationItem* item); protected: diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 11d8b29884..0d62630b31 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -98,9 +98,7 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - llinfos << "Merov debug : sessionAdded, adding conversation item, id = " << session_id << llendl; addConversationListItem(session_id, true); - llinfos << "Merov debug : sessionAdded, adding LLIMFloater, id = " << session_id << llendl; LLIMFloater::addToHost(session_id, true); } @@ -111,9 +109,7 @@ void LLIMFloaterContainer::sessionActivated(const LLUUID& session_id, const std: void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - llinfos << "Merov debug : sessionVoiceOrIMStarted, adding conversation item, id = " << session_id << llendl; addConversationListItem(session_id, true); - llinfos << "Merov debug : sessionVoiceOrIMStarted, adding LLIMFloater, id = " << session_id << llendl; LLIMFloater::addToHost(session_id, true); } @@ -433,6 +429,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) return false; } LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id); + LLIMFloater *conversation_floater = LLIMFloater::findInstance(session_id); if (type == "remove_participant") { @@ -446,20 +443,18 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event) } else if (type == "add_participant") { - if (!participant_view) + LLConversationItemSession* session_model = dynamic_cast<LLConversationItemSession*>(get_ptr_in_map(mConversationsItems,session_id)); + LLConversationItemParticipant* participant_model = (session_model ? session_model->findParticipant(participant_id) : NULL); + if (!participant_view && session_model && participant_model) { - LLConversationItemSession* session_model = dynamic_cast<LLConversationItemSession*>(get_ptr_in_map(mConversationsItems,session_id)); - if (session_model) - { - LLConversationItemParticipant* participant_model = session_model->findParticipant(participant_id); - if (participant_model) - { - participant_view = createConversationViewParticipant(participant_model); - participant_view->addToFolder(session_view); - participant_view->setVisible(TRUE); - } - } - + participant_view = createConversationViewParticipant(participant_model); + participant_view->addToFolder(session_view); + participant_view->setVisible(TRUE); + } + // CHUI-441 : + if (conversation_floater && participant_model) + { + conversation_floater->addConversationViewParticipant(participant_model); } } else if (type == "update_participant") |