Page MenuHome

CacheFile Open Operator Crashes Blender
Closed, ResolvedPublic

Description

System Information

Blender Version

Broken: blender-2.78-34a502c16a-linux-glibc219-x86_64]

Short description of error
Running bpy.ops.cachefile.open(filepath='path/to/abc/here'), crashes Blender.

Exact steps for others to reproduce the error
Run in Blender python console or text editor:

bpy.ops.cachefile.open(filepath='path/to/abc/here')

Result = Blender Crash

Event Timeline

Campbell Barton (campbellbarton) lowered the priority of this task from 90 to 50.Mar 26 2017, 9:10 AM

When called from the Dynamic Context Menu (spacebar), it works just fine

Operator requires an execution override to work properly:

bpy.ops.cachefile.open('INVOKE_REGION_WIN')

This should probably be the default behavior for this operator call.

Seems to be an invalid pointer when this operator is directly executed from python instead of being invoked before.

1diff --git a/source/blender/editors/io/io_cache.c b/source/blender/editors/io/io_cache.c
2index c5eea94..b6aa193 100644
3--- a/source/blender/editors/io/io_cache.c
4+++ b/source/blender/editors/io/io_cache.c
5@@ -98,6 +98,12 @@ static int cachefile_open_exec(bContext *C, wmOperator *op)
6 /* hook into UI */
7 PropertyPointerRNA *pprop = op->customdata;
8
9+ /* this seems a NULL pointer here when bpy.ops.cachefile.open() is called from python... */
10+ if (!pprop) {
11+ cachefile_init(C, op);
12+ pprop = op->customdata;
13+ }
14+
15 if (pprop->prop) {
16 /* when creating new ID blocks, use is already 1, but RNA
17 * pointer se also increases user, so this compensates it */