diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-10-29 22:51:26 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-10-29 22:51:26 +0100 |
commit | 8452be9eac2991b02cbb71ccb4827b48070e9243 (patch) | |
tree | 60f97e91468a5472432b68f7cedfe285f89b37d7 /crawl-ref/source/tilesdl.cc | |
parent | 15fdb53f75a829c72a08e10b654277c2c737d64a (diff) | |
download | crawl-ref-8452be9eac2991b02cbb71ccb4827b48070e9243.tar.gz crawl-ref-8452be9eac2991b02cbb71ccb4827b48070e9243.zip |
Add big fat (but not fat or scary enough) warnings about save corruption.
On a modern computer, crawl tends to process commands fast enough that
closing the game is likely to happen during some waiting for event loop,
and thus typically not cause not cause a lock-up or memory corruption
but "merely" allow cheating. This is not acceptable, and once in a while
you get more classical results of doing naughty stuff from a signal
handler.
One way of fixing this would be setting a flag (seen_hups) and killing
any functions that wait for an event. This can be tricky because:
* ncurses like to sabotage EINTR. We need to abort it both on SIGHUP
and on SIGWINCH, without race conditions. The documentation says
SIGWINCH is supposed to return a pseudo key code, KEY_RESIZE but
this doesn't seem to be working. Not sure how to abort it on HUP.
* win32's console functions don't have an equivalent to EINTR. Perhaps
injecting a fake key with WriteConsoleInput would work?
* same for tiles and Android.
* yesno() without a safeanswer will loop forever
Diffstat (limited to 'crawl-ref/source/tilesdl.cc')
-rw-r--r-- | crawl-ref/source/tilesdl.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index 62c6097518..a83c152f12 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -699,6 +699,11 @@ int TilesFramework::getch_ck() // close it if (/*event.active.state == 0x04 SDL_APPACTIVE &&*/ event.active.gain == 0) { + // SAVE-CORRUPTING BUG!!! We're likely in a place that may + // have an inconsistent state, or at least allows cheating + // by forcing a save in the middle of some processing. + // This must set a flag, kill all waits then continue + // until a graceful shutdown. if (crawl_state.need_save) save_game(true); exit(0); @@ -819,6 +824,8 @@ int TilesFramework::getch_ck() break; case WME_QUIT: + // SAVE-CORRUPTING BUG!!! This must not save here, but set + // a flag, disable all waits and allow a graceful shutdown. if (crawl_state.need_save) save_game(true); exit(0); |