Skip to content

Commit

Permalink
Fixed a bug where no parameters were passed to OnTargetUnitRemoved fu…
Browse files Browse the repository at this point in the history
…nction when the Ressource widget was disabled.
  • Loading branch information
Backupiseasy committed Sep 17, 2024
1 parent 26e77cd commit 9fb48cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Widgets/ScriptWidget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ end]]
OnFocusUnitRemoved = {
FunctionExample = [[
-- Example for function OnFocusUnitRemoved:
function(tp_frame, unit)
function()
-- ...
end]]
},
Expand Down Expand Up @@ -550,7 +550,7 @@ function Widget:OnUnitRemoved(widget_frame, unit)
end

if unit.IsFocus then
ProcessEvent("OnFocusUnitRemoved", widget_frame, unit)
ProcessEvent("OnFocusUnitRemoved")
end

--widget_frame:SetShown(unit.CustomPlateSettings or next(ScriptsForAllPlates))
Expand Down
10 changes: 7 additions & 3 deletions Widgets/WidgetHandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,16 @@ function WidgetHandler:DisableWidget(widget_name)
self.EnabledTargetWidgets[widget_name] = nil

widget:OnDisable()
widget:OnTargetUnitRemoved(tp_frame, tp_frame.unit)
for _, tp_frame in pairs(Addon.PlatesCreated) do
if tp_frame.unit.IsSoftTarget then
widget:OnTargetUnitRemoved(tp_frame, tp_frame.unit)
end
end
elseif widget.FocusOnly then
self.EnabledFocusWidget = nil

widget:OnDisable()
widget:OnFocusUnitRemoved(tp_frame, tp_frame.unit)
widget:OnFocusUnitRemoved()
else
local widget = self.EnabledWidgets[widget_name]

Expand Down Expand Up @@ -409,7 +413,7 @@ function WidgetHandler:OnUnitRemoved(tp_frame, unit)
end

if unit.IsFocus and self.EnabledFocusWidget then
self.EnabledFocusWidget:OnFocusUnitRemoved(tp_frame, unit)
self.EnabledFocusWidget:OnFocusUnitRemoved()
end

local plate_widgets = tp_frame.widgets
Expand Down

0 comments on commit 9fb48cb

Please sign in to comment.