http://www.perlmonks.org?node_id=247923


in reply to Segmentation fault

Unless you're importing Tk in your Quiting package, you're calling CORE::exit. Try calling Tk::exit instead.

If that doesn't work, you can always invoke the MainWindow Toplevel's destroy method and place your cleanup code after the call to MainLoop.