Details! Damage Meter

Details! Damage Meter

250M Downloads

Background color not correctly applied in options panel, because of a leaking global variable

Undisclosed-Information opened this issue ยท 4 comments

commented

The background color setting in Bars: General > Background > Color is not correctly applied, because the internal function is assigning an empty global variable to the color table, see window_options2_sections.lua#L1353

{--background color
     type = "color",
     get = function()
          local r, g, b = unpack(currentInstance.row_info.fixed_texture_background_color)
          local alpha = currentInstance.row_info.alpha --unused assignment
          return {r, g, b, a} --leaking global 'a'
     end,
     set = function(self, r, g, b, a)
          editInstanceSetting(currentInstance, "SetBarSettings", nil, nil, nil, nil, nil, nil, {r, g, b, a})
          afterUpdate()
     end,
     name = Loc ["STRING_COLOR"],
     desc = Loc ["STRING_OPTIONS_BAR_COLOR_DESC"],
},

Solution

{--background color
     type = "color",
     get = function()
          local r, g, b, a = unpack(currentInstance.row_info.fixed_texture_background_color)
          return {r, g, b, a}
     end,
     set = function(self, r, g, b, a)
          editInstanceSetting(currentInstance, "SetBarSettings", nil, nil, nil, nil, nil, nil, {r, g, b, a})
          afterUpdate()
     end,
     name = Loc ["STRING_COLOR"],
     desc = Loc ["STRING_OPTIONS_BAR_COLOR_DESC"],
},
commented
commented

An issue yes, but it does not effect the application of the setting. Only the fill of the color selector.

commented

even if the alpha value is internally stored with value 0, opening the selector instantly puts it back to alpha 1, updating the windows with alpha value 1. With that said it definitely does effect the application.

Here is another one I found... window_options2_sections.lua#L2020

commented

Oh absolutely yes. It would effect that since it would reset the selector. As I said, an issue to be sure. I'll get to adding it to a fix, thanks for reporting.