dxx-rebirth/similar
Kp 27586fe0b9 Track newmenu return value using std::shared_ptr
JoeNotCharles reports that gcc-12 (architecture unspecified) warns
because `newmenu::process_until_closed` stores the address of a stack
local into a heap-allocated structure.  Switch to a less efficient
implementation that does not provoke a compiler warning:

- Store `shared_ptr<int>`, not `int *`, in the `newmenu`
- `shared_ptr::operator*()` and `shared_ptr::operator bool()` allow most
  use sites to be unchanged relative to a bare pointer
- Load the return value from the `shared_ptr<int>`.  If the newmenu
  terminated before return, as should always happen, this is a slightly
  less efficient version of the same code as before.  If the newmenu was
  still open despite its `exists` flag claiming otherwise, then the
  returned value may be incorrect, but the read will be well-formed, the
  `newmenu`'s eventual write will write to the heap-backed int (rather
  than writing into the stack allocated to
  `newmenu::process_until_closed`), and the memory will be freed when
  both `process_until_closed` has returned and the `newmenu` has been
  destroyed.

Reported-by: JoeNotCharles <10a2b2d337>
2023-01-14 19:05:37 +00:00
..
2d Make enumerate inherit ranges::subrange directly 2022-12-31 16:21:47 +00:00
3d Remove inline stub for swap_polygon_model_data 2023-01-07 22:17:31 +00:00
arch Use correct coefficient table for 11Khz sounds 2023-01-08 14:19:52 +00:00
editor Make partial_range_t inherit from ranges::subrange 2023-01-14 19:05:37 +00:00
main Track newmenu return value using std::shared_ptr 2023-01-14 19:05:37 +00:00
misc Move SysNoHogDir to CGameArg 2023-01-07 22:17:31 +00:00