[Bf-blender-cvs] [4bcc7a2] master: Fix T44556: Crash on the World Properties > Preview

Sergey Sharybin noreply at git.blender.org
Thu Apr 30 11:54:26 CEST 2015


Commit: 4bcc7a2ec6bf6937778a2227c7f938c50a0fafe5
Author: Sergey Sharybin
Date:   Thu Apr 30 14:52:59 2015 +0500
Branches: master
https://developer.blender.org/rB4bcc7a2ec6bf6937778a2227c7f938c50a0fafe5

Fix T44556: Crash on the World Properties > Preview

Issue was caused by de-referencing NULL pointer, rres did not have any
views because nothing was rendered yet.

Needs more closer look about where else such a de-reference could happen.

===================================================================

M	source/blender/editors/render/render_preview.c

===================================================================

diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 2c353c1..b9aa6ac 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -532,6 +532,7 @@ static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect,
 	int newx = BLI_rcti_size_x(rect);
 	int newy = BLI_rcti_size_y(rect);
 	bool ok = false;
+	bool has_rectf = false;
 
 	if (!split || first) sprintf(name, "Preview %p", (void *)sa);
 	else sprintf(name, "SecondPreview %p", (void *)sa);
@@ -551,11 +552,14 @@ static bool ed_preview_draw_rect(ScrArea *sa, int split, int first, rcti *rect,
 	re = RE_GetRender(name);
 
 	RE_AcquireResultImageViews(re, &rres);
+	/* TODO(sergey): Is there a cleaner way to do this? */
+	if (!BLI_listbase_is_empty(&rres.views)) {
+		/* material preview only needs monoscopy (view 0) */
+		rv = RE_RenderViewGetById(&rres, 0);
+		has_rectf = rv->rectf != NULL;
+	}
 
-	/* material preview only needs monoscopy (view 0) */
-	rv = RE_RenderViewGetById(&rres, 0);
-
-	if (rv->rectf) {
+	if (has_rectf) {
 		
 		if (ABS(rres.rectx - newx) < 2 && ABS(rres.recty - newy) < 2) {




More information about the Bf-blender-cvs mailing list