Thread: Two 100012 Bugs
View Single Post
09/04/15, 01:27 AM   #5
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
One More Bug

While testing a new version of my ChatIt addons multiple windows feature I found one more bug.

It is possible to transfer the main (first) window tab of the primary container to another container. It is also possible to transfer every window out of the primary container which really causes problems.

I do realize this sounds minor & highly unlikely...but it happened to me on accident, that's how I found it so I figure it could happen to someone else. Also since there are code checks to prevent transferring the 1st tab out of the primary container, it is obviously an unwanted feature so I thought I'de post this.

While testing my addon I was attempting to transfer several tab windows to another chat container. To make this easier I moved them very close to each other. When you drag a tab window if the mouse overlaps more than one TabDropArea, both controls get monitored by function
Warning: Spoiler

Since the tab drop areas are overlapping and that function uses GetUIMousePosition() both controls will pass the Contains(...) check and thus both containers get self.insertIndex set.
Then when you actually drop the tab, whichever container it goes into properly gets self.insertIndex set to nil, but the other container will still have self.insertIndex set to some value (what value is irrelevant).

If it dropped into the primary container and you then drag the 1st tab window from the primary container and drop it on top of the other containers TabDropArea (the other container still has self.insertIndex set so) it will transfer the tab to that container, even though it was the 1st tab window of the primary container because:
Warning: Spoiler

container ~= initiator AND container:CanTakeTabDrop() will return true (because container still has self.insertIndex set to some value) then it will set tabDropContainer = container, then the TransferWindow code will run which will transfer the first tab window to the other container.





Lua Code:
  1. function SharedChatSystem:StopContainersTabDrop(initiator)
  2.    ...
  3.     -- It looks like it could use a primary check here:
  4.     if not initiator:IsPrimary() then
  5.         initiator:TransferWindow(1, tabDropContainer)
  6.     end
  7.    ...
  8. end
and something to ensure all container.insertIndex values get wiped out on a tab drop.

Last edited by circonian : 09/04/15 at 07:13 PM.
  Reply With Quote