WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Wish List (https://www.wowinterface.com/forums/forumdisplay.php?f=15)
-   -   Fix Wrapped_OnLeave in SecureHandlers.lua (https://www.wowinterface.com/forums/showthread.php?t=48362)

Vrul 10-15-13 06:15 PM

Fix Wrapped_OnLeave in SecureHandlers.lua
 
Wrapped_OnLeave will only work for the most recent wrap due to:
Code:

        if ( motion and self:GetAttribute("_wrapentered")) then
                self:SetAttribute("_wrapentered", nil);

That prevents any further wraps from running. A simple fix is:
Code:

local function Wrapped_OnLeave(self, header, preBody, postBody, wrap,
                              motion, ...)
    local allow, message;
    if ( motion and self:GetAttribute("_wrapentered")) then
        if ( IsWrapEligible(self) ) then
            allow, message =
                SecureHandler_Other_Execute(header, self, "self",
                                            preBody);
            if (allow == false) then
                self:SetAttribute("_wrapentered", nil);
                return;
            end
        end
    end

    securecall(SafeCallWrappedHandler, self, wrap, motion, ...);
    self:SetAttribute("_wrapentered", nil);

    if (postBody and message ~= nil) then
        SecureHandler_Other_Execute(header, self, "self,message",
                                    postBody, message);
    end
end

However, I'm not even sure why the _wrapentered check is even needed. The motion argument already ensures that it was a hardware event. I thought it might be to ensure an OnLeave for every OnEnter, but OnEnter can trigger multiple time without a corresponding OnLeave so that can't be it.

If anything I think the _wrapentered should be scrapped and maybe a check added if motion isn't set to see if the frame that caused the focus loss was secure and still allow the script to run.


All times are GMT -6. The time now is 03:09 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI