Commits

Vadim Savchuk committed 572ce35

STORM-1566 FIXED Sidebar tabs didn't detach by drag-n-drop.

The regression was introduced in the fix of EXP-856 (changeset 9e650f2750b5).

Comments (0)

Files changed (1)

indra/newview/llsidetray.cpp

 		LLSideTray* side_tray = LLSideTray::getInstance();
 
 		// Check if the tab we are dragging is docked.
-		if (!side_tray->isTabAttached(getName())) return FALSE;
+		if (!side_tray->isTabAttached(mTabName)) return FALSE;
 
 		// Same value is hardcoded in LLDragHandle::handleHover().
 		const S32 undock_threshold = 12;
 		if (delta_x <= -undock_threshold ||	delta_x >= undock_threshold	||
 			delta_y <= -undock_threshold ||	delta_y >= undock_threshold)
 		{
-			LLSideTrayTab* tab = side_tray->getTab(getName());
+			LLSideTrayTab* tab = side_tray->getTab(mTabName);
 			if (!tab) return FALSE;
 
 			tab->setDocked(false);
 		, mDragLastScreenX(0)
 		, mDragLastScreenY(0)
 		, mBadgeDriver(NULL)
-	{}
+	{
+		// Find out the tab name to use in handleHover().
+		size_t pos = getName().find("_button");
+		llassert(pos != std::string::npos);
+		mTabName = getName().substr(0, pos);
+	}
 
 	friend class LLUICtrlFactory;
 
 	S32		mDragLastScreenX;
 	S32		mDragLastScreenY;
 
+	std::string					mTabName;
 	LLSideTrayTabBadgeDriver*	mBadgeDriver;
 };
 
 bool LLSideTray::isTabAttached(const std::string& name)
 {
 	LLSideTrayTab* tab = getTab(name);
+	llassert(tab);
 	if (!tab) return false;
 
 	return std::find(mTabs.begin(), mTabs.end(), tab) != mTabs.end();