summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-09-29 21:51:30 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-09-29 22:20:02 +0300
commitd5e8f51b615cee91bf072e2c3b111c7f5af0e052 (patch)
treef1f5502ef2445f2360f8d6106ccdd1ec4b050219
parent7748898b25202b5c90f676bd8e3e8a258a307723 (diff)
#4750 Crash in LLToolBarView::handleDropTool
-rw-r--r--indra/llui/lltoolbar.cpp2
-rw-r--r--indra/llui/lltoolbar.h2
-rw-r--r--indra/newview/llfloatertoybox.cpp2
-rw-r--r--indra/newview/lltoolbarview.cpp29
-rw-r--r--indra/newview/lltoolbarview.h2
5 files changed, 23 insertions, 14 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 5955a28fa3..56ab6e9bae 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -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
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 5556406fbd..a3f044c256 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -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
{
diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp
index f6257dbd3d..5e3ec366d5 100644
--- a/indra/newview/llfloatertoybox.cpp
+++ b/indra/newview/llfloatertoybox.cpp
@@ -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));
//
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 0063e0b7fd..c1ec5fa183 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -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())
- {
- // do nothing
- }
- else
+ if (gToolBarView->mDragToolbarButton)
{
- 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);
+ }
}
}
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index 7cecd81052..7212f099b7 100644
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -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; }