Fix: Class memory access on the color management tear-down
Pull Request: https://projects.blender.org/blender/blender/pulls/138670
This commit is contained in:

committed by
Sergey Sharybin

parent
1c21de6f77
commit
9d4b236d13
@@ -103,22 +103,33 @@ struct ColormanageProcessor {
|
||||
bool is_data_result;
|
||||
};
|
||||
|
||||
static struct global_gpu_state {
|
||||
static struct GlobalGPUState {
|
||||
GlobalGPUState() = default;
|
||||
|
||||
~GlobalGPUState()
|
||||
{
|
||||
if (curve_mapping) {
|
||||
BKE_curvemapping_free(curve_mapping);
|
||||
}
|
||||
}
|
||||
|
||||
/* GPU shader currently bound. */
|
||||
bool gpu_shader_bound;
|
||||
bool gpu_shader_bound = false;
|
||||
|
||||
/* Curve mapping. */
|
||||
CurveMapping *curve_mapping, *orig_curve_mapping;
|
||||
bool use_curve_mapping;
|
||||
int curve_mapping_timestamp;
|
||||
} global_gpu_state = {false};
|
||||
CurveMapping *curve_mapping = nullptr, *orig_curve_mapping = nullptr;
|
||||
bool use_curve_mapping = false;
|
||||
int curve_mapping_timestamp = 0;
|
||||
} global_gpu_state;
|
||||
|
||||
static struct GlobalColorPickingState {
|
||||
GlobalColorPickingState() = default;
|
||||
|
||||
static struct global_color_picking_state {
|
||||
/* Cached processor for color picking conversion. */
|
||||
std::shared_ptr<const ocio::CPUProcessor> cpu_processor_to;
|
||||
std::shared_ptr<const ocio::CPUProcessor> cpu_processor_from;
|
||||
bool failed;
|
||||
} global_color_picking_state = {nullptr};
|
||||
bool failed = false;
|
||||
} global_color_picking_state;
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -621,12 +632,8 @@ void colormanagement_init()
|
||||
|
||||
void colormanagement_exit()
|
||||
{
|
||||
if (global_gpu_state.curve_mapping) {
|
||||
BKE_curvemapping_free(global_gpu_state.curve_mapping);
|
||||
}
|
||||
|
||||
memset(&global_gpu_state, 0, sizeof(global_gpu_state));
|
||||
memset(&global_color_picking_state, 0, sizeof(global_color_picking_state));
|
||||
global_gpu_state = GlobalGPUState();
|
||||
global_color_picking_state = GlobalColorPickingState();
|
||||
|
||||
colormanage_free_config();
|
||||
}
|
||||
|
Reference in New Issue
Block a user