Commit 0fdb645d authored by Niklas Haas's avatar Niklas Haas

demos/sdl2: fix undefined behavior with overlay

The struct goes out of scope before it's used
parent 16744b29
Pipeline #7177 passed with stages
in 1 minute and 45 seconds
......@@ -288,15 +288,17 @@ static void render_frame(const struct pl_swapchain_frame *frame)
};
const struct pl_tex *osd = osd_plane.texture;
struct pl_overlay target_ol;
if (osd) {
target.num_overlays = 1;
target.overlays = &(struct pl_overlay) {
target_ol = (struct pl_overlay) {
.plane = osd_plane,
.rect = { 0, 0, osd->params.w, osd->params.h },
.mode = PL_OVERLAY_NORMAL,
.repr = image.repr,
.color = image.color,
};
target.overlays = &target_ol;
target.num_overlays = 1;
}
if (!pl_render_image(renderer, &image, &target, &render_params)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment