Fix T45041: (2.75RC) blender crashes when I choose 'Refresh DataBlock Previews'.

Not sure where this sneaked in, but we for sure need a valid context (otherwise
we'd need to pass a Main alog too).

This is to be backported to final 2.75.
This commit is contained in:
Bastien Montagne 2015-06-12 09:55:04 +02:00 committed by Sergey Sharybin
parent e3f07d1f17
commit 033c532bfb
Notes: blender-bot 2023-02-14 09:01:27 +01:00
Referenced by issue #45041, (2.75RC) blender crashes when I choose 'Refresh DataBlock Previews'.
1 changed files with 3 additions and 1 deletions

View File

@ -4777,6 +4777,7 @@ static void WM_OT_dependency_relations(wmOperatorType *ot)
/* *************************** Mat/tex/etc. previews generation ************* */
typedef struct PreviewsIDEnsureStack {
bContext *C;
Scene *scene;
BLI_LINKSTACK_DECLARE(id_stack, ID *);
@ -4801,7 +4802,7 @@ static bool previews_id_ensure_callback(void *todo_v, ID **idptr, int UNUSED(cd_
if (id && (id->flag & LIB_DOIT)) {
if (ELEM(GS(id->name), ID_MA, ID_TE, ID_IM, ID_WO, ID_LA)) {
previews_id_ensure(NULL, todo->scene, id);
previews_id_ensure(todo->C, todo->scene, id);
}
id->flag &= ~LIB_DOIT; /* Tag the ID as done in any case. */
BLI_LINKSTACK_PUSH(todo->id_stack, id);
@ -4826,6 +4827,7 @@ static int previews_ensure_exec(bContext *C, wmOperator *UNUSED(op))
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
preview_id_stack.scene = scene;
preview_id_stack.C = C;
id = (ID *)scene;
do {