diff Editor.lua @ 250:d7a7ef367faf

Fix Lua error when opening global config from editor
author Flick
date Mon, 28 Mar 2011 16:23:21 -0700
parents f255cd69e890
children 5ab04f393b0b
line wrap: on
line diff
--- a/Editor.lua	Mon Mar 28 14:52:35 2011 -0700
+++ b/Editor.lua	Mon Mar 28 16:23:21 2011 -0700
@@ -43,11 +43,6 @@
   frame:SetClampedToScreen(true)
   frame:Hide()
 
-  frame:SetScript("OnHide", 
-    function(...)
-      ReAction:SetConfigMode(false)
-    end)
-
   self.title = ("%s - %s"):format(L["ReAction"],L["Bar Editor"])
   self.gui:SetTitle(self.title)
 
@@ -61,7 +56,19 @@
         type = "execute",
         name = L["Global Config"],
         desc = L["Opens ReAction global configuration settings panel"],
-        func = function() ReAction:ShowOptions(); self:Close() end,
+        func = function() 
+            -- AceConfigDialog calls :Open() after every selection, making it
+            -- generally not possible to cleanly close from a menu item.
+            -- If you don't use a custom frame, you can use ACD:Close(), but since
+            -- we're using a custom frame, we have to do the work of closing later in an
+            -- OnUpdate script.
+            ReAction:ShowOptions();
+            frame:SetScript("OnUpdate",
+              function()
+                self:Close()
+                frame:SetScript("OnUpdate",nil)
+              end)
+          end,
         order = 1
       },
       desc = {