Skip to content

Lambda crash


from chlorophyll import CodeView


from tkinter import Tk
root = Tk()
text = CodeView(root)
text.pack()
def test():
    text.insert("end", "\n"*2)
    root.destroy()
    # Using after_idle still causes an error
    # The error caused by after_idle is exclusive to Mac OS
    # Error: objc[number]: Invalid or prematurely-freed autorelease pool hex_value.
    # root.after_idle(root.destroy)

root.after(10, test)
# root.after_idle(test)
# Using after_idle still causes an error when used with test()
# It causes a corrupted memory error
"""
invalid command name "4532481984<lambda>"
    while executing
"4532481984<lambda>"
    ("after" script)
objc[27242]: autorelease pool page 0x7fe67c93d000 corrupted
  magic     0x00000000 0x00000000 0x00000000 0x00000000
  should be 0xa1a1a1a1 0x4f545541 0x454c4552 0x21455341
  pthread   0x1170bd5c0
  should be 0x1170bd5c0
"""
root.mainloop()


root = Tk()
root.after(10, root.destroy)
root.mainloop()