From 4000c36207d475d52ea646d9a66dd05e04828cd5 Mon Sep 17 00:00:00 2001 From: haranp Date: Sun, 8 Feb 2009 23:01:50 +0000 Subject: Fix [2151183]: SIGHUP with the range view annotator active maintained the annotated colours when saving. Fixed by adding the ability to store arbitrary exit hooks to be executed on (unusual) shutdown; for now they're executed FIFO, but it should probably be LIFO with a stack. Anyway the only thing that uses this now is the range view annotator. Oh, and it only works if you're using libunix.cc. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8999 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/libunix.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crawl-ref/source/libunix.cc') diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc index e1d3b71df4..c259c45146 100644 --- a/crawl-ref/source/libunix.cc +++ b/crawl-ref/source/libunix.cc @@ -335,6 +335,12 @@ static void handle_hangup(int) crawl_state.saving_game = true; if (crawl_state.need_save) { + // Clean up all the hooks. + for (unsigned i = 0; i < crawl_state.exit_hooks.size(); ++i) + crawl_state.exit_hooks[i]->restore_state(); + + crawl_state.exit_hooks.clear(); + // save_game(true) also exits, saving us the trouble of doing so. save_game(true); } -- cgit v1.2.3-54-g00ecf