# HG changeset patch # User Flick # Date 1236122315 0 # Node ID 6a4b4d3c5fade877134c068e7198ac9379281711 # Parent a7f18adee694b7812a6ebb79c2fa3220121f143f More fixes for button base class diff -r a7f18adee694 -r 6a4b4d3c5fad classes/Button.lua --- a/classes/Button.lua Tue Mar 03 23:18:05 2009 +0000 +++ b/classes/Button.lua Tue Mar 03 23:18:35 2009 +0000 @@ -76,11 +76,12 @@ end function Button:Destroy() - local f = self.frame - gridProxy:RemoveGridFrame(f) - f:Hide() - f:SetParent(trash) - f:ClearAllPoints() + local f = self:GetFrame() + if f then + f:Hide() + f:SetParent(trash) + f:ClearAllPoints() + end end function Button:GetFrame() @@ -122,8 +123,8 @@ local useCount = pool.useCount if id == nil then repeat - local nWraps = pool.nWraps - if useCount[hint] == nil or useCount[hint] == nWraps then + local nWraps = pool.nWraps or 0 + if hint and (useCount[hint] == nil or useCount[hint] == nWraps) then id = hint else local start = hint or 1 @@ -148,7 +149,7 @@ end pool.nWraps = nWraps + 1 end - until id + until id ~= nil end useCount[id] = (useCount[id] or 0) + 1 return id