Hammerspoon: Crash when creating a blockAlert, reloading configuration, then clicking OK

Created on 11 Nov 2020  Â·  2Comments  Â·  Source: Hammerspoon/hammerspoon

  1. Add the following to the Hammerspoon configuration at ~/.hammerspoon/init.lua:
hs.hotkey.bind({"⌘", "⇧"}, "1", function()
    hs.dialog.blockAlert("I’m going to", "crash…")
end)
hs.hotkey.bind({"⌘", "⇧"}, "2", function() hs.reload() end)
  1. Reload the Hammerspoon configuration.

  2. Press ⌘⇧1 to show the blockAlert. Don’t press OK.

  3. Press ⌘⇧2 to reload the Hammerspoon configuration.

  4. Press OK on the blockAlert.

Hammerspoon crashes.

I think this has to do with the blockAlert being garbage collected when the configuration is reloaded.

bug crasher

Most helpful comment

Looks like we'll need to store the model NSAlert as a global variable so we can dismiss it when the module runs __gc

All 2 comments

Looks like we'll need to store the model NSAlert as a global variable so we can dismiss it when the module runs __gc

Not related, but "TIL" you could use the modifier key symbols in your keybinds like that!

hs.hotkey.bind({"⌘", "⇧"}...
Was this page helpful?
0 / 5 - 0 ratings

Related issues

asmagill picture asmagill  Â·  4Comments

Pancia picture Pancia  Â·  4Comments

luckman212 picture luckman212  Â·  4Comments

dasmurphy picture dasmurphy  Â·  4Comments

iliyang picture iliyang  Â·  4Comments