Color Management: fixed crash when changing display device in screenshot save operator

In fact, color management settings shouldn't be editing from this operator since
screenshot is using OpenGL which is in sRGB space, but fixed issues with Image
Format initialization and added NULL pointer checks.
This commit is contained in:
Sergey Sharybin 2012-09-18 10:11:46 +00:00
parent c50c654543
commit 3d9d7275b5
3 changed files with 10 additions and 1 deletions

@ -1227,6 +1227,9 @@ void BKE_imformat_defaults(ImageFormatData *im_format)
im_format->imtype = R_IMF_IMTYPE_PNG; im_format->imtype = R_IMF_IMTYPE_PNG;
im_format->quality = 90; im_format->quality = 90;
im_format->compress = 90; im_format->compress = 90;
BKE_color_managed_display_settings_init(&im_format->display_settings);
BKE_color_managed_view_settings_init(&im_format->view_settings);
} }
void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *imbuf) void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *imbuf)

@ -245,7 +245,7 @@ static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
/* image template */ /* image template */
RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &scd->im_format, &ptr); RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &scd->im_format, &ptr);
uiTemplateImageSettings(layout, &ptr, TRUE); uiTemplateImageSettings(layout, &ptr, FALSE);
/* main draw call */ /* main draw call */
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);

@ -377,6 +377,9 @@ static void rna_ColorManagedDisplaySettings_display_device_update(Main *UNUSED(b
{ {
ID *id = ptr->id.data; ID *id = ptr->id.data;
if (!id)
return;
if (GS(id->name) == ID_SCE) { if (GS(id->name) == ID_SCE) {
Scene *scene = (Scene *) id; Scene *scene = (Scene *) id;
@ -486,6 +489,9 @@ static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
{ {
ID *id = ptr->id.data; ID *id = ptr->id.data;
if (!id)
return;
if (GS(id->name) == ID_SCE) { if (GS(id->name) == ID_SCE) {
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL); WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
} }