CleverRaven/Cataclysm-DDA — pull request #9573 by BevapDin (2014-10-16 18:47:25+00:00)
Title: Prevent memory leaks from not deleting windows

Some windows created via `newwin` have **never** been deleted, most notably the item information window (`game::inventory_item_menu`) and the targeting window (`game::target`) that appears every time one tries to fire/throw something).

Other windows have not been deleted in some circumstances (usually when the function is left early).

----

I was to lazy to evaluate all code paths and add a `delwin` call for each window, so I just added a wrapper based on `std::unique_ptr` that makes sure that the window is deleted when the wrapper object goes out of scope.

----

- `show_auto_pickup` and `test_pattern` not deleted at all, only erased.
- `player::power_bionics` and `player::power_mutations`: one code path can lead to the window not been deleted at the end (action == "activating"), but also not deleted inside the loop (the branch to `deactivate_*`).
- `iuse::water_purifier` one code path (when the player enters anything but 1, 2 or 3) returns without deleting the window.
- `game::opening_screen` there are some filesystem related checks at the top the leave the function, but the windows are created before that and not deleted, similar the function is called recursively without deleting the windows.
- `set_scenario` some code paths can leave the function without deleting the window.
- `set_description` way to many code paths leave the function, some don't delete the windows, no path deletes `w_location`.
- `w_hit_animation` was overridden with new windows, but never deleted.
- `Pickup::pick_up` some paths leave the function without deleting the windows.
- `veh_interact::allocate_windows` the temporary window is not deleted.
- `worldfactory::show_worldgen_tab_options` not all windows are deleted.
- `worldfactory::show_worldgen_tab_confirm` path without deleting the window.
- `defense_game::setup` - window not deleted at all.
- `game::inventory_item_menu` window not deleted at all.
- `iuse::firecracker_pack` window not deleted at all.
- `snake_game::start_game` window not deleted at all.
- `sokoban_game::start_game` window not deleted at all.
- `game::target` window not deleted at all.
- `worldfactory::make_new_world` window not deleted at all.