View Single Post
09-07-14, 10:42 AM   #3
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Originally Posted by myrroddin View Post
I'm not going to fine-tooth comb the code, but this chunk at line 180 doesn't look like it should work correctly.
Code:
local function updateHeight(self)
    local self = getChicchai(self)
    if(self.State ~= DOWN) then return end
    self.Frame:ScrollToBottom()
    self.Frame:SetHeight(getMinHeight(self.Frame))
end
Let me get this straight:
  1. Pass self (presumably the AddOn reference?) to the function updateHeight
  2. Immediately overwrite self with an entirely new value (why??)
  3. If the new value is anything other than DOWN, exit out
No wonder self is throwing nil errors. Based on a cursory look at the code, how in the world are you, as a follow-up author, supposed to keep track of what self is referring?
I have no idea how it works, the code is really confusing to me. That block of code is the one that's throwing most errors and the only one that straight up breaks the addon to force it into a permanently minimized state.

This chunk at line 151 throws an error sometimes too, and stops the chat frame from being maximized on mouseover. It works after a reload though, so I'm not sure what's wrong.
Lua Code:
  1. local CheckEnterLeave
  2. if(MaximizeOnEnter) then
  3.     CheckEnterLeave = function(self)
  4.         self = getChicchai(self)
  5.         if(MouseIsOver(self.Frame) and not self.wasOver) then
  6.             self.wasOver = true
  7.             Animate(self, UP, WaitAfterEnter)
  8.         elseif(self.wasOver and not MouseIsOver(self.Frame)) then
  9.             self.wasOver = nil
  10.             Animate(self, DOWN, WaitAfterLeave)
  11.         end
  12.     end
  13. end
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote