Fix #30876, #30932: crash in material preview render after undo or file load,

due to old material copies hanging around in the preview database.

This crash happened pretty randomly, but was especially noticeable when using
node groups.
This commit is contained in:
Brecht Van Lommel 2012-04-13 12:12:54 +00:00
parent 3578a93eb8
commit 44258c3c9a

@ -987,20 +987,19 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short
IconPreviewSize *cur_size = ip->sizes.first;
while (cur_size) {
ShaderPreview sp;
memset(&sp, 0, sizeof(ShaderPreview));
ShaderPreview *sp = MEM_callocN(sizeof(ShaderPreview), "Icon ShaderPreview");
/* construct shader preview from image size and previewcustomdata */
sp.scene = ip->scene;
sp.owner = ip->owner;
sp.sizex = cur_size->sizex;
sp.sizey = cur_size->sizey;
sp.pr_method = PR_ICON_RENDER;
sp.pr_rect = cur_size->rect;
sp.id = ip->id;
sp->scene = ip->scene;
sp->owner = ip->owner;
sp->sizex = cur_size->sizex;
sp->sizey = cur_size->sizey;
sp->pr_method = PR_ICON_RENDER;
sp->pr_rect = cur_size->rect;
sp->id = ip->id;
common_preview_startjob(&sp, stop, do_update, progress);
common_preview_startjob(sp, stop, do_update, progress);
shader_preview_free(sp);
cur_size = cur_size->next;
}