dxx-rebirth/similar/main
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
..
ai.cpp Use enum class for sound_sample_rate 2023-01-07 22:17:31 +00:00
aipath.cpp Pass robot_info to move_towards_segment_center 2022-12-02 04:09:20 +00:00
automap.cpp Fix various Win32 build failures due to ambiguous operator[]() 2022-10-23 23:00:24 +00:00
bm.cpp Use enum class for properties_init result 2023-01-07 22:17:31 +00:00
bmread.cpp Harden bm_read_alias against bad input 2023-01-07 22:17:31 +00:00
cntrlcen.cpp Pass ranges::subrange to reactor_read_n 2022-12-31 16:21:47 +00:00
collide.cpp Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00
config.cpp Rework convert_integer to return result in some cases 2023-01-14 19:05:37 +00:00
console.cpp Fix OS X clang build 2022-10-31 00:51:32 +00:00
controls.cpp
credits.cpp Use std::span for CREDITS_FILE 2022-09-24 17:47:52 +00:00
digiobj.cpp Use enum class for sound_channel 2022-12-17 13:16:28 +00:00
dumpmine.cpp Remove macro wrapper around nm_messagebox 2023-01-14 19:05:37 +00:00
effects.cpp
endlevel.cpp Use enum class for polygon_model_index 2022-12-18 18:32:14 +00:00
fireball.cpp Use enum class for polygon_model_index 2022-12-18 18:32:14 +00:00
fuelcen.cpp Inline object_create_explosion into callers 2022-11-07 01:59:34 +00:00
fvi.cpp Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00
game.cpp Use enum class for sound_sample_rate 2023-01-07 22:17:31 +00:00
gamecntl.cpp Fix OS X clang build 2022-10-31 00:51:32 +00:00
gamefont.cpp
gamemine.cpp
gamerend.cpp Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00
gamesave.cpp Remove macro wrapper around nm_messagebox 2023-01-14 19:05:37 +00:00
gameseg.cpp Use enum class for delta_light_index 2022-11-07 01:59:34 +00:00
gameseq.cpp Pass ranges::subrange to glitz_menu 2022-12-31 16:21:47 +00:00
gauges.cpp Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00
generate-kconfig-udlr.py Fix generate-kconfig-udlr.py for Python3 2022-11-13 21:17:23 +00:00
hostage.cpp
hud.cpp Fix various Win32 build failures due to ambiguous operator[]() 2022-10-23 23:00:24 +00:00
iff.cpp Inline PHYSFSX_fseek(..., SEEK_SET) 2022-12-18 23:10:39 +00:00
inferno.cpp Simplify SDL_QUIT handling 2023-01-14 19:05:37 +00:00
kconfig.cpp Merge commit 'refs/pull/657/head' into master 2022-08-23 02:13:01 +00:00
kconfig.ui-table.cpp
kmatrix.cpp Use alias template per_player_array for arrays that are MAX_PLAYERS long 2022-09-24 17:47:53 +00:00
laser.cpp Inline object_create_muzzle_flash into callers 2022-11-13 21:17:23 +00:00
lighting.cpp Factor out computing object light from color 2022-12-31 16:21:47 +00:00
menu.cpp Fix off-by-strlen(sep) in buffer capacity check 2023-01-14 19:05:37 +00:00
mglobal.cpp Use std::span for poison helper functions 2022-09-24 17:47:51 +00:00
mission.cpp Remove macro wrapper around nm_messagebox 2023-01-14 19:05:37 +00:00
morph.cpp Switch do_morph_frame to enumerate(zip()) 2023-01-07 22:17:31 +00:00
multi.cpp Add compile-time sanity check on multi_send_data_direct length 2023-01-14 19:05:37 +00:00
multibot.cpp Inline object_create_explosion into callers 2022-11-07 01:59:34 +00:00
net_udp.cpp Remove macro wrapper around nm_messagebox 2023-01-14 19:05:37 +00:00
newdemo.cpp Remove macro wrapper around nm_messagebox 2023-01-14 19:05:37 +00:00
newmenu.cpp Track newmenu return value using std::shared_ptr 2023-01-14 19:05:37 +00:00
object.cpp Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00
paging.cpp Move vclip id validation down into paging_touch_vclip 2023-01-14 19:05:37 +00:00
physics.cpp
piggy.cpp Harden D2 loading of D1 texture numbers 2023-01-07 22:17:31 +00:00
player.cpp Use enum class for polygon_model_index 2022-12-18 18:32:14 +00:00
playsave.cpp Rework convert_integer to return result in some cases 2023-01-14 19:05:37 +00:00
polyobj.cpp Use if constexpr to guard calls to align_polygon_model_data 2022-12-31 16:21:47 +00:00
powerup.cpp Detect escort goal even for silent powerups 2023-01-07 22:17:31 +00:00
render.cpp Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00
robot.cpp Return ranges::subrange from robot_get_anim_state 2022-12-31 16:21:47 +00:00
scores.cpp Remove macro wrapper around nm_messagebox 2023-01-14 19:05:37 +00:00
segment.cpp Use enum class for delta_light_index 2022-11-07 01:59:34 +00:00
slew.cpp
songs.cpp Fix various Win32 build failures due to ambiguous operator[]() 2022-10-23 23:00:24 +00:00
state.cpp Remove macro wrapper around nm_messagebox 2023-01-14 19:05:37 +00:00
switch.cpp
terrain.cpp
texmerge.cpp Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00
text.cpp
titles.cpp Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00
vclip.cpp
vers_id.cpp Fix buffer overread at startup 2022-10-19 01:17:33 +00:00
wall.cpp Make enumerate inherit ranges::subrange directly 2022-12-31 16:21:47 +00:00
weapon.cpp Use enum class for bitmap_index 2022-12-31 16:21:47 +00:00