diff -r 7c7d01be2310 indra/newview/llpanelgroupinvite.h --- a/indra/newview/llpanelgroupinvite.h Mon Jul 11 16:52:00 2011 -0400 +++ b/indra/newview/llpanelgroupinvite.h Tue Jul 12 12:50:49 2011 -0700 @@ -29,6 +29,8 @@ #include "llpanel.h" #include "lluuid.h" +#include + class LLPanelGroupInvite : public LLPanel { @@ -50,7 +52,7 @@ virtual BOOL postBuild(); protected: class impl; - impl* mImplementation; + boost::shared_ptr mImplementation; BOOL mPendingUpdate; LLUUID mStoreSelected; diff -r 7c7d01be2310 indra/newview/llpanelgroupinvite.cpp --- a/indra/newview/llpanelgroupinvite.cpp Mon Jul 11 16:52:00 2011 -0400 +++ b/indra/newview/llpanelgroupinvite.cpp Tue Jul 12 12:50:49 2011 -0700 @@ -45,6 +45,8 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" +#include + class LLPanelGroupInvite::impl { public: @@ -64,11 +66,11 @@ static void callbackClickRemove(void* userdata); static void callbackSelect(LLUICtrl* ctrl, void* userdata); static void callbackAddUsers(const uuid_vec_t& agent_ids, - void* user_data); + boost::weak_ptr panel); static void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, - void* user_data); + boost::weak_ptr panel); bool inviteOwnerCallback(const LLSD& notification, const LLSD& response); @@ -283,18 +285,11 @@ if ( panelp ) { - //Right now this is hard coded with some knowledge that it is part - //of a floater since the avatar picker needs to be added as a dependent - //floater to the parent floater. - //Soon the avatar picker will be embedded into this panel - //instead of being it's own separate floater. But that is next week. - //This will do for now. -jwolk May 10, 2006 LLFloater* parentp; parentp = gFloaterView->getParentFloater(panelp); - parentp->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(impl::callbackAddUsers, _1, - panelp->mImplementation), - TRUE)); + parentp->addDependentFloater(LLFloaterAvatarPicker::show( + boost::bind(impl::callbackAddUsers, _1, boost::weak_ptr(panelp->mImplementation)),TRUE)); } } @@ -361,31 +356,29 @@ //static -void LLPanelGroupInvite::impl::callbackAddUsers(const uuid_vec_t& agent_ids, void* user_data) +void LLPanelGroupInvite::impl::callbackAddUsers(const uuid_vec_t& agent_ids, boost::weak_ptr panel) { std::vector names; for (S32 i = 0; i < (S32)agent_ids.size(); i++) { LLAvatarNameCache::get(agent_ids[i], - boost::bind(&LLPanelGroupInvite::impl::onAvatarNameCache, _1, _2, user_data)); + boost::bind(&LLPanelGroupInvite::impl::onAvatarNameCache, _1, _2, panel)); } } void LLPanelGroupInvite::impl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name, - void* user_data) + boost::weak_ptr panel) { - impl* selfp = (impl*) user_data; - - if (selfp) + if (!panel.expired()) { std::vector names; uuid_vec_t agent_ids; agent_ids.push_back(agent_id); names.push_back(av_name.getCompleteName()); - selfp->addUsers(names, agent_ids); + panel.lock()->addUsers(names, agent_ids); } } @@ -401,7 +394,6 @@ LLPanelGroupInvite::~LLPanelGroupInvite() { - delete mImplementation; } void LLPanelGroupInvite::setCloseCallback(void (*close_callback)(void*), @@ -586,7 +578,7 @@ if ( mImplementation->mInvitees ) { mImplementation->mInvitees->setCommitOnSelectionChange(TRUE); - mImplementation->mInvitees->setCommitCallback(impl::callbackSelect, mImplementation); + mImplementation->mInvitees->setCommitCallback(impl::callbackSelect, mImplementation.get()); } LLButton* button = getChild("add_button", recurse); @@ -601,7 +593,7 @@ getChild("remove_button", recurse); if ( mImplementation->mRemoveButton ) { - mImplementation->mRemoveButton->setClickedCallback(impl::callbackClickRemove, mImplementation); + mImplementation->mRemoveButton->setClickedCallback(impl::callbackClickRemove, mImplementation.get()); mImplementation->mRemoveButton->setEnabled(FALSE); } @@ -609,14 +601,14 @@ getChild("ok_button", recurse); if ( mImplementation->mOKButton ) { - mImplementation->mOKButton->setClickedCallback(impl::callbackClickOK, mImplementation); + mImplementation->mOKButton->setClickedCallback(impl::callbackClickOK, mImplementation.get()); mImplementation->mOKButton->setEnabled(FALSE); } button = getChild("cancel_button", recurse); if ( button ) { - button->setClickedCallback(impl::callbackClickCancel, mImplementation); + button->setClickedCallback(impl::callbackClickCancel, mImplementation.get()); } mImplementation->mOwnerWarning = getString("confirm_invite_owner_str");