1
0
Fork 0

Codefix: do not leave pointers to stack allocations in globals

pull/13829/head
Rubidium 2025-03-15 12:11:38 +01:00 committed by rubidium42
parent dae788e2e3
commit c13226cdf8
2 changed files with 3 additions and 3 deletions

View File

@ -9907,8 +9907,8 @@ static void DecodeSpecialSprite(uint8_t *buf, uint num, GrfLoadingStage stage)
*/
static void LoadNewGRFFileFromFile(GRFConfig &config, GrfLoadingStage stage, SpriteFile &file)
{
_cur.file = &file;
_cur.grfconfig = &config;
AutoRestoreBackup cur_file(_cur.file, &file);
AutoRestoreBackup cur_config(_cur.grfconfig, &config);
Debug(grf, 2, "LoadNewGRFFile: Reading NewGRF-file '{}'", config.filename);

View File

@ -1833,7 +1833,7 @@ void ViewportDoDraw(const Viewport *vp, int left, int top, int right, int bottom
dp.zoom = ZOOM_LVL_MIN;
dp.width = UnScaleByZoom(dp.width, zoom);
dp.height = UnScaleByZoom(dp.height, zoom);
_cur_dpi = &dp;
AutoRestoreBackup cur_dpi(_cur_dpi, &dp);
if (vp->overlay != nullptr && vp->overlay->GetCargoMask() != 0 && vp->overlay->GetCompanyMask().Any()) {
/* translate to window coordinates */