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