| 1914 | } |
| 1915 | |
| 1916 | int Core::Shutdown ( void ) |
| 1917 | { |
| 1918 | #ifdef LINUX_BUILD |
| 1919 | extern void dfhack_crashlog_shutdown(); |
| 1920 | dfhack_crashlog_shutdown(); |
| 1921 | #endif |
| 1922 | |
| 1923 | if(errorstate) |
| 1924 | return true; |
| 1925 | errorstate = 1; |
| 1926 | |
| 1927 | shutdown = true; |
| 1928 | |
| 1929 | // Make sure the console thread shutdowns before clean up to avoid any |
| 1930 | // unlikely data races. |
| 1931 | if (d->iothread.joinable()) { |
| 1932 | con.shutdown(); |
| 1933 | } |
| 1934 | |
| 1935 | ServerMain::block(); |
| 1936 | |
| 1937 | d->iothread.join(); |
| 1938 | |
| 1939 | if (hotkey_mgr) { |
| 1940 | delete hotkey_mgr; |
| 1941 | } |
| 1942 | |
| 1943 | if(plug_mgr) |
| 1944 | { |
| 1945 | delete plug_mgr; |
| 1946 | plug_mgr = nullptr; |
| 1947 | } |
| 1948 | // invalidate all modules |
| 1949 | Textures::cleanup(); |
| 1950 | DFSDL::cleanup(); |
| 1951 | DFSteam::cleanup(getConsole()); |
| 1952 | d.reset(); |
| 1953 | return -1; |
| 1954 | } |
| 1955 | |
| 1956 | // FIXME: this is HORRIBLY broken |
| 1957 | // from ncurses |
no test coverage detected