sirinsidiator / ESO-LibAddonMenu

http://www.esoui.com/downloads/info7-LibAddonMenu.html
Artistic License 2.0
41 stars 20 forks source link

dropdown choiceTooltips can interfere with other addons #115

Closed sirinsidiator closed 4 years ago

sirinsidiator commented 4 years ago

User Gandalf has reported in the comments that the current way how LAM registers the choiceTooltips on a dropdown can interfere with other addons:

The prehook function ShowTooltip interferce with other addons prehooking m_comboBox for adding their tooltips. A check whether control.tooltip actually exists is missing. As a consequence if this hook is triggered by an other addon, the gobal InformationTooltip will be cleared. A check should be added:

local function SetupTooltips(comboBox, choicesTooltips)
#75    local function ShowTooltip(control)
#75.1     if not control.tooltip then return end -- proposed fix 
#76       InitializeTooltip(InformationTooltip, control, TOPLEFT, 0, 0, BOTTOMRIGHT)
#77       SetTooltipText(InformationTooltip, LAM.util.GetStringFromValue(control.tooltip))
#78       InformationTooltipTopLevel:BringWindowToTop()
#79   end

Should also investigate if making use of the new handler namespaces could lead to a more robust solution than the current one.

sirinsidiator commented 4 years ago

The interference isn't actually a problem, since other addons are supposed to use the choiceTooltips feature instead of manually hooking into the comboBox. That aside, there really is some room for improvement with the new way to set handlers which will provide better compatibility with hypothetical hooks by other addons.