Fix crash in viewer node with quick toggle of frame in Compositor

The issue was caused by a non-initialized ibuf_ used to set the non-color
space to. For now limit the tweaks to the image data-block, which is always
ensured. This makes it consistent with the GPU compositor which does not
have access to ibuf at the moment when the meta-data is being checked.

Ideally we do need to set the color space, but it needs to happen consistently,
and in a thread-safe manner. The way how the CPU compositor releases the
ibuf right after acquisition does not feel safe, so less we rely on it is
better.
This commit is contained in:
Sergey Sharybin
2024-05-24 19:23:02 +02:00
parent ca0b38032c
commit f4a7c42255

View File

@@ -170,13 +170,13 @@ void ViewerOperation::update_memory_buffer_finished(MemoryBuffer * /*output*/,
if (meta_data && meta_data->is_data) {
image_->flag &= ~IMA_VIEW_AS_RENDER;
IMB_colormanagement_assign_float_colorspace(
ibuf_, IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DATA));
/* TODO: Assign image buffer's color space to either non-color or linear, to be fully correct
* about the content of the pixels. This needs to happen consistently with the GPU compositor,
* and also consistently with the ibuf_ acquired as a state of this operation (which is not
* always guaranteed to happen here. */
}
else {
image_->flag |= IMA_VIEW_AS_RENDER;
IMB_colormanagement_assign_float_colorspace(
ibuf_, IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR));
}
}