| 259 | } |
| 260 | |
| 261 | Framework::~Framework() |
| 262 | { |
| 263 | LogInfo("Destroying framework"); |
| 264 | // Stop any audio first, as if you've got ongoing music/samples it could call back into the |
| 265 | // framework for the threadpool/data read/all kinda of stuff it shouldn't do on a |
| 266 | // half-destroyed framework |
| 267 | audioShutdown(); |
| 268 | LogInfo("Stopping threadpool"); |
| 269 | p->threadPool.reset(); |
| 270 | LogInfo("Clearing stages"); |
| 271 | p->ProgramStages.clear(); |
| 272 | LogInfo("Saving config"); |
| 273 | if (config().getBool("Config.Save")) |
| 274 | config().save(); |
| 275 | |
| 276 | LogInfo("Shutdown"); |
| 277 | // Make sure we destroy the data implementation before the renderer to ensure any possibly |
| 278 | // cached images are already destroyed |
| 279 | this->data.reset(); |
| 280 | if (createWindow) |
| 281 | { |
| 282 | displayShutdown(); |
| 283 | } |
| 284 | LogInfo("SDL shutdown"); |
| 285 | PHYSFS_deinit(); |
| 286 | SDL_Quit(); |
| 287 | instance = nullptr; |
| 288 | } |
| 289 | |
| 290 | Framework &Framework::getInstance() |
| 291 | { |