Skip to content

Commit d5e8f51

Browse files
committed
#4750 Crash in LLToolBarView::handleDropTool
1 parent 7748898 commit d5e8f51

5 files changed

Lines changed: 23 additions & 14 deletions

File tree

indra/llui/lltoolbar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ bool LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
10541054
// if drop is set, it's time to call the callback to get the operation done
10551055
if (handled && drop)
10561056
{
1057-
handled = mHandleDropCallback(cargo_data, x, y, this);
1057+
handled = mHandleDropCallback(cargo_data, cargo_type, x, y, this);
10581058
}
10591059

10601060
// We accept only single tool drop on toolbars

indra/llui/lltoolbar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class LLIconCtrl;
4141

4242
typedef boost::function<void (S32 x, S32 y, LLToolBarButton* button)> tool_startdrag_callback_t;
4343
typedef boost::function<bool (S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)> tool_handledrag_callback_t;
44-
typedef boost::function<bool (void* data, S32 x, S32 y, LLToolBar* toolbar)> tool_handledrop_callback_t;
44+
typedef boost::function<bool (void* data, EDragAndDropType cargo_type, S32 x, S32 y, LLToolBar* toolbar)> tool_handledrop_callback_t;
4545

4646
class LLToolBarButton : public LLButton
4747
{

indra/newview/llfloatertoybox.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ bool LLFloaterToybox::postBuild()
6363

6464
mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
6565
mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
66-
mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
66+
mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4,_5));
6767
mToolBar->setButtonEnterCallback(boost::bind(&LLFloaterToybox::onToolBarButtonEnter,this,_1));
6868

6969
//

indra/newview/lltoolbarview.cpp

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ bool LLToolBarView::postBuild()
110110
{
111111
mToolbars[i]->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
112112
mToolbars[i]->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
113-
mToolbars[i]->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
113+
mToolbars[i]->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4,_5));
114114
mToolbars[i]->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded,_1));
115115
mToolbars[i]->setButtonRemoveCallback(boost::bind(LLToolBarView::onToolBarButtonRemoved,_1));
116116
}
@@ -624,8 +624,14 @@ bool LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp
624624
return false;
625625
}
626626

627-
bool LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar)
627+
bool LLToolBarView::handleDropTool( void* cargo_data, EDragAndDropType cargo_type, S32 x, S32 y, LLToolBar* toolbar)
628628
{
629+
if (cargo_type == DAD_PERSON)
630+
{
631+
// DAD_PERSON means that cargo_data contains an uuid, not an LLInventoryObject
632+
resetDragTool(NULL);
633+
return false;
634+
}
629635
bool handled = false;
630636
LLInventoryObject* inv_item = static_cast<LLInventoryObject*>(cargo_data);
631637

@@ -647,15 +653,18 @@ bool LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
647653
if (old_toolbar_loc != LLToolBarEnums::TOOLBAR_NONE)
648654
{
649655
llassert(gToolBarView->mDragToolbarButton);
650-
old_toolbar = gToolBarView->mDragToolbarButton->getParentByType<LLToolBar>();
651-
if (old_toolbar->isReadOnly() && toolbar->isReadOnly())
652-
{
653-
// do nothing
654-
}
655-
else
656+
if (gToolBarView->mDragToolbarButton)
656657
{
657-
int old_rank = LLToolBar::RANK_NONE;
658-
gToolBarView->removeCommand(command_id, old_rank);
658+
old_toolbar = gToolBarView->mDragToolbarButton->getParentByType<LLToolBar>();
659+
if (old_toolbar->isReadOnly() && toolbar->isReadOnly())
660+
{
661+
// do nothing
662+
}
663+
else
664+
{
665+
int old_rank = LLToolBar::RANK_NONE;
666+
gToolBarView->removeCommand(command_id, old_rank);
667+
}
659668
}
660669
}
661670

indra/newview/lltoolbarview.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class LLToolBarView : public LLUICtrl
9292

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

0 commit comments

Comments
 (0)