Color Management: fixed crash when changing display device in screenshot save operator
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 18 Sep 2012 10:11:46 +0000 (10:11 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 18 Sep 2012 10:11:46 +0000 (10:11 +0000)
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.

source/blender/blenkernel/intern/image.c
source/blender/editors/screen/screendump.c
source/blender/makesrna/intern/rna_color.c

index 208f5ea89e32d489c8210862632ef909a1704066..8fb5f00dee2cdd960f7c25d08bf47e733811fba8 100644 (file)
@@ -1227,6 +1227,9 @@ void BKE_imformat_defaults(ImageFormatData *im_format)
        im_format->imtype = R_IMF_IMTYPE_PNG;
        im_format->quality = 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)
index 301df719142d5f5fef09c3a712eaf4597280c6ec..aeae79aa9d00e3ee510dab3a807822d03347f044 100644 (file)
@@ -245,7 +245,7 @@ static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
 
        /* image template */
        RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &scd->im_format, &ptr);
-       uiTemplateImageSettings(layout, &ptr, TRUE);
+       uiTemplateImageSettings(layout, &ptr, FALSE);
 
        /* main draw call */
        RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
index 0edcad59577936f2c94c5dcf78c1d67cdaad2c99..e7b09506ab4f289868943c4545b40905cb04c4cc 100644 (file)
@@ -377,6 +377,9 @@ static void rna_ColorManagedDisplaySettings_display_device_update(Main *UNUSED(b
 {
        ID *id = ptr->id.data;
 
+       if (!id)
+               return;
+
        if (GS(id->name) == ID_SCE) {
                Scene *scene = (Scene *) id;
 
@@ -486,6 +489,9 @@ static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
 {
        ID *id = ptr->id.data;
 
+       if (!id)
+               return;
+
        if (GS(id->name) == ID_SCE) {
                WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
        }