#4750 Crash in LLToolBarView::handleDropTool

master
Andrey Kleshchev 2025-09-29 21:51:30 +03:00
parent 7748898b25
commit d5e8f51b61
5 changed files with 23 additions and 14 deletions

View File

@ -1054,7 +1054,7 @@ bool LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
// if drop is set, it's time to call the callback to get the operation done
if (handled && drop)
{
handled = mHandleDropCallback(cargo_data, x, y, this);
handled = mHandleDropCallback(cargo_data, cargo_type, x, y, this);
}
// We accept only single tool drop on toolbars

View File

@ -41,7 +41,7 @@ class LLIconCtrl;
typedef boost::function<void (S32 x, S32 y, LLToolBarButton* button)> tool_startdrag_callback_t;
typedef boost::function<bool (S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)> tool_handledrag_callback_t;
typedef boost::function<bool (void* data, S32 x, S32 y, LLToolBar* toolbar)> tool_handledrop_callback_t;
typedef boost::function<bool (void* data, EDragAndDropType cargo_type, S32 x, S32 y, LLToolBar* toolbar)> tool_handledrop_callback_t;
class LLToolBarButton : public LLButton
{

View File

@ -63,7 +63,7 @@ bool LLFloaterToybox::postBuild()
mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4,_5));
mToolBar->setButtonEnterCallback(boost::bind(&LLFloaterToybox::onToolBarButtonEnter,this,_1));
//

View File

@ -110,7 +110,7 @@ bool LLToolBarView::postBuild()
{
mToolbars[i]->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
mToolbars[i]->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
mToolbars[i]->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
mToolbars[i]->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4,_5));
mToolbars[i]->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded,_1));
mToolbars[i]->setButtonRemoveCallback(boost::bind(LLToolBarView::onToolBarButtonRemoved,_1));
}
@ -624,8 +624,14 @@ bool LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp
return false;
}
bool LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar)
bool LLToolBarView::handleDropTool( void* cargo_data, EDragAndDropType cargo_type, S32 x, S32 y, LLToolBar* toolbar)
{
if (cargo_type == DAD_PERSON)
{
// DAD_PERSON means that cargo_data contains an uuid, not an LLInventoryObject
resetDragTool(NULL);
return false;
}
bool handled = false;
LLInventoryObject* inv_item = static_cast<LLInventoryObject*>(cargo_data);
@ -647,15 +653,18 @@ bool LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
if (old_toolbar_loc != LLToolBarEnums::TOOLBAR_NONE)
{
llassert(gToolBarView->mDragToolbarButton);
old_toolbar = gToolBarView->mDragToolbarButton->getParentByType<LLToolBar>();
if (old_toolbar->isReadOnly() && toolbar->isReadOnly())
if (gToolBarView->mDragToolbarButton)
{
// do nothing
}
else
{
int old_rank = LLToolBar::RANK_NONE;
gToolBarView->removeCommand(command_id, old_rank);
old_toolbar = gToolBarView->mDragToolbarButton->getParentByType<LLToolBar>();
if (old_toolbar->isReadOnly() && toolbar->isReadOnly())
{
// do nothing
}
else
{
int old_rank = LLToolBar::RANK_NONE;
gToolBarView->removeCommand(command_id, old_rank);
}
}
}

View File

@ -92,7 +92,7 @@ public:
static void startDragTool(S32 x, S32 y, LLToolBarButton* toolbarButton);
static bool handleDragTool(S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type);
static bool handleDropTool(void* cargo_data, S32 x, S32 y, LLToolBar* toolbar);
static bool handleDropTool(void* cargo_data, EDragAndDropType cargo_type, S32 x, S32 y, LLToolBar* toolbar);
static void resetDragTool(LLToolBarButton* toolbarButton);
LLInventoryObject* getDragItem();
LLView* getBottomToolbar() { return mBottomToolbarPanel; }