Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/modules/core/producer_colour.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* producer_colour.c
* Copyright (C) 2003-2025 Meltytech, LLC
* Copyright (C) 2003-2026 Meltytech, LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -130,8 +130,6 @@ static int producer_get_image(mlt_frame frame,
mlt_properties_set_int(producer_props, "_format", *format);
mlt_properties_set(producer_props, "_resource", now);

mlt_service_unlock(MLT_PRODUCER_SERVICE(producer));

if (!strcmp(now, "checkerboard")) {
struct mlt_image_s img;
mlt_image_set_values(&img, NULL, *format, *width, *height);
Expand Down Expand Up @@ -210,8 +208,6 @@ static int producer_get_image(mlt_frame frame,
mlt_image_format_name(*format));
}
}
} else {
mlt_service_unlock(MLT_PRODUCER_SERVICE(producer));
}

// Create the alpha channel
Expand All @@ -234,6 +230,9 @@ static int producer_get_image(mlt_frame frame,
memcpy(*buffer, image, size);
}

// The cached image may be replaced by another thread once unlocked
mlt_service_unlock(MLT_PRODUCER_SERVICE(producer));

// Now update properties so we free the copy after
mlt_frame_set_image(frame, *buffer, size, mlt_pool_release);
mlt_frame_set_alpha(frame, alpha, alpha_size, mlt_pool_release);
Expand Down
Loading