[FIRE-32218] [Local Mesh] Crash when creating surrogate mesh after closing local mesh floater

don't rely on cached this pointer in the callback. Use the explictly stored floater_pointer instead
meow-7.2.2
Beq 2022-11-01 15:27:17 +00:00
parent 492a208b75
commit d5bc1d996a
2 changed files with 31 additions and 27 deletions

View File

@ -367,12 +367,10 @@ bool LLFloaterLocalMesh::processPrimCreated(LLViewerObject* object)
// Select the new object
LLSelectMgr::getInstance()->selectObjectAndFamily(object, TRUE);
update_selected_target( object->getID() );
// LLUUID local_id{"aee92334-90e9-110b-7c03-0ff3bc19de63"};
LLUUID local_id{};
auto* volp = object->getVolume();
if(!volp)
{
@ -393,37 +391,42 @@ bool LLFloaterLocalMesh::processPrimCreated(LLViewerObject* object)
{
return false;
}
auto scroll_ctrl_selected_item = this->mScrollCtrl->getFirstSelected();
if(!scroll_ctrl_selected_item){return true;}; // at this point we have a valid object even if we can't fill it.
auto scroll_ctrl_selected_column = scroll_ctrl_selected_item->getColumn(LOCAL_TRACKING_ID_COLUMN);
if(!scroll_ctrl_selected_column){return true;}; // at this point we have a valid object even if we can't fill it.
auto objectlist_combo_box = this->getChild<LLComboBox>("object_apply_list");
if(!objectlist_combo_box){return true;}; // at this point we have a valid object even if we can't fill it.
// TODO: replace this with check box. "apply selected"
bool apply_local { scroll_ctrl_selected_item && scroll_ctrl_selected_column && objectlist_combo_box };
if ( apply_local )
if(auto floater_ptr = LLLocalMeshSystem::getInstance()->getFloaterPointer())
{
local_id = scroll_ctrl_selected_column->getValue().asUUID();
// fill it up with local goodness
static const bool use_scale {true};
floater_ptr->update_selected_target( object->getID() );
auto scroll_ctrl_selected_item = floater_ptr->mScrollCtrl->getFirstSelected();
if(!scroll_ctrl_selected_item){return true;}; // at this point we have a valid object even if we can't fill it.
// // make sure the selection is still valid, and if so - get id.
auto scroll_ctrl_selected_column = scroll_ctrl_selected_item->getColumn(LOCAL_TRACKING_ID_COLUMN);
if(!scroll_ctrl_selected_column){return true;}; // at this point we have a valid object even if we can't fill it.
// get selected local file id, object idx and use_scale boolean
int object_idx = objectlist_combo_box->getFirstSelectedIndex();
LLLocalMeshSystem::getInstance()->applyVObject(object->getID(), local_id, object_idx, use_scale);
volp = object->getVolume();
if(!volp)
auto objectlist_combo_box = floater_ptr->getChild<LLComboBox>("object_apply_list");
if(!objectlist_combo_box){return true;}; // at this point we have a valid object even if we can't fill it.
// TODO: replace this with check box. "apply selected"
bool apply_local { scroll_ctrl_selected_item && scroll_ctrl_selected_column && objectlist_combo_box };
if ( apply_local )
{
return true;
local_id = scroll_ctrl_selected_column->getValue().asUUID();
// fill it up with local goodness
static const bool use_scale {true};
// // make sure the selection is still valid, and if so - get id.
// get selected local file id, object idx and use_scale boolean
int object_idx = objectlist_combo_box->getFirstSelectedIndex();
LLLocalMeshSystem::getInstance()->applyVObject(object->getID(), local_id, object_idx, use_scale);
volp = object->getVolume();
if(!volp)
{
return true;
}
volume_params = volp->getParams();
object->updateVolume(volume_params);
object->markForUpdate(true);
}
volume_params = volp->getParams();
object->updateVolume(volume_params);
object->markForUpdate(true);
}
return true;
}

View File

@ -244,6 +244,7 @@ class LLLocalMeshSystem : public LLSingleton<LLLocalMeshSystem>
// floater two-way communication
void registerFloaterPointer(LLFloaterLocalMesh* floater_ptr);
LLFloaterLocalMesh* getFloaterPointer(){return mFloaterPtr;};
void triggerFloaterRefresh( bool keep_selection=true );
std::vector<LLLocalMeshFile::LLLocalMeshFileInfo> getFileInfoVector() const;
std::vector<std::string> getFileLog(LLUUID local_file_id) const;