Files
VVVVVV/desktop_version/src
NyakoFox 6810c5fa8c Fix #1223 (analogue mode segfault)
When `SDL_RenderReadPixels` fails for some reason, the game tries to
free the temporary source surface it creates. Unfortunately, it never
sets it to `NULL` after, so the next time the game tries to render the
filter, it'll try to work with a memory region that was already freed.

To fix this, I just replaced `SDL_FreeSurface(*src);` with
`VVV_freefunc(SDL_FreeSurface, *src);` which is a helper macro which
sets the pointer to NULL after freeing.

Now, there's a new issue -- since the temporary buffer is now NULL,
next frame we'll try to remake it! So I've introduced a static bool
which disables the filter entirely if `SDL_RenderReadPixels` fails.
Without this, it'd create and destroy a surface every frame, which
could lead to slowdown. (Not as slow as the filter when it DOES work,
but still...)

I also added a line which frees the second temporary surface... it's
weird that was missing in the first place, but I think reimplementing
analogue mode was one of the last things I did for the renderer
rewrite anyways.

Resolves #1223.
2025-04-29 20:54:11 -04:00
..
2024-01-09 15:48:41 -08:00
2024-01-09 15:48:41 -08:00
2025-04-21 20:09:57 -04:00
2025-04-21 20:09:57 -04:00
2025-04-21 20:09:57 -04:00
2021-12-18 00:01:32 -08:00
2021-09-27 10:32:23 -07:00
2025-04-21 20:09:57 -04:00
2025-04-21 20:09:57 -04:00
2025-04-21 20:09:57 -04:00
2024-01-09 15:48:41 -08:00
2024-08-02 22:25:00 -07:00
2025-04-21 20:09:57 -04:00
2022-12-31 20:04:56 -08:00
2022-03-13 23:50:37 -07:00
2025-04-21 20:09:57 -04:00
2024-11-03 21:54:44 -08:00
2025-04-21 20:09:57 -04:00
2024-01-08 19:17:44 -08:00
2024-08-27 15:13:24 -07:00
2024-02-03 18:11:11 -08:00
2025-04-21 20:09:57 -04:00
2024-11-07 09:53:45 -08:00
2023-11-30 08:38:40 -08:00
2024-01-09 15:48:41 -08:00
2023-11-27 12:09:42 -05:00
2022-12-31 20:04:56 -08:00
2021-09-24 16:37:27 -07:00
2022-12-29 16:13:54 -08:00
2023-02-27 23:00:41 -08:00
2023-02-27 23:00:41 -08:00
2023-03-21 19:59:48 -07:00
2022-11-14 19:40:23 -08:00
2020-11-04 12:06:57 -05:00
2023-11-27 12:09:42 -05:00