View Single Post
07-28-18, 01:37 AM   #10
PhoenixPower
A Defias Bandit
Join Date: Aug 2011
Posts: 3
I believe you call you call C_LFGList.GetSearchResults too early, returning in invalid values getting passed to ApplyToGroup on the second click. You shouldn't need a secure button to execute protected functions here though. The code execution of your snippet goes something like this.

First click, you start a search and get the search results before they are ready. The filtering code populates FilteredIDs with old invalid values.

Now the second time you click the ApplyToGroup function fails silentyly because FilteredIDs[1] is not a valid group to join. Then the function doesn't return but continue and starts another search, but at this point you already called a secure function for this hardware event, so this search call shows the "Interface action failed because of an Addon" error. But by now the search results from the first click have been received properly so your GetSearchResults/GetSearchResultInfo code populates the FilteredIDs table with valid values.

Then on the third click your ApplyToGroup call works and you join the first group, but again the code never seems to start a new search again. It just keeps repopulating FilteredIDs with valid values from GetSearchResults and calling ApplyToGroup on them every time. Internally it seems that after calling ApplyToGroup it removes that ID from the values that GetSearchResults will return, so you get a different group each time until the list is depleted.

How it's meant to be done is after a call to C_LFGList.Search, wait for the LFG_LIST_SEARCH_RESULTS_RECEIVED (or LFG_LIST_SEARCH_FAILED) event and in that OnEvent callback fill your SearchResults table. Then on the second click your function will enter the if statement and apply to a valid group. Also put a return at the end of the if statement so no new search gets started.

The parent error seems to come from using UIGoldBorderButtonTemplate, which tries to anchor itself to $parentDetails. Right now it's used nowhere in the Blizzard UI, but it was used in Mists of Pandaria and Warlords of Draenor for the challenge mode frame. If you use UIPanelButtonTemplate for example it shows no error.

Last edited by PhoenixPower : 07-28-18 at 01:39 AM.
  Reply With Quote