Page MenuHome

Forward compatibility after D113
Closed, InvalidPublic


The issue was found during T51198 investigation.

PropertyType RNA_property_type(PropertyRNA *prop)
	return rna_ensure_property(prop)->type;

rna_ensure_property always returns NULL for IDP_ID for Blender builds before D113

There is discussion in T51198 about the issue.
Since the issue described in T51198 was solved, I've created this separate task.
@Bastien Montagne (mont29), @Sergey Sharybin (sergey), @Campbell Barton (campbellbarton)

Event Timeline

Copy of comments from T51198 regarding that issue:

@Bastien Montagne (mont29):

But P465 is a no-go for me, imho it is totally unacceptable to twist that way our .blend file just to ensure forward compat (not to mention how evil it is to change actual data, even if only for a few micro seconds, in writefile!). I’m tempted to consider this a bug in previous blender (if a function can return NULL and is not checked, then bug is in code using it). Can only think about protecting against this for future (e.g. by nuking IDProps of unknown type at read time, keeping them around is call for issues anyway at some point)… Would not mind @Sergey Sharybin (sergey) Sharybin (sergey) or @Campbell Barton (campbellbarton) input here though.

@Sergey Sharybin (sergey):

@Bastien Montagne (mont29), we indeed should not modify anything from the main database during file save. This was known for giving issues in the past. What i remember happening at some point is that we were constructing temp copy of the objects and made modifications on those. Need to be careful tho, because that will modify pointers of the struct itself.

@Bastien Montagne (mont29):

@Sergey Sharybin (sergey) Sharybin (sergey) yes, temp structs is the way to go here - while keeping orig pointer one as 'uuid' (pointer value in file), to ensure re-allocating temp memory later in write process does not re-use same mem pointer…

But that’s not the main issue here, main issue is that P465 horribly tweaks IDProps to save them in a way that new pointer IDProps do not make older blender crash when loading a file saved with those new properties. Imho this is not really acceptable, especially since the root of the issue remains - should we introduce a new IDProp type in the future, it will again make older Blender crash. So to me this is a bug in current code, that is trivial to fix (e.g. by removing any unknown IDProp type at read time), but we should not try to fix this for previous versions… As ugly as it is :(

Aaron Carlisle (Blendify) lowered the priority of this task from 90 to 50.Apr 20 2017, 6:50 PM
Bastien Montagne (mont29) changed the task status from Unknown Status to Unknown Status.May 3 2017, 5:43 PM
Bastien Montagne (mont29) claimed this task.

After quick chat on IRC with @Sergey Sharybin (sergey) and @Campbell Barton (campbellbarton), we agreed that we couldn’t find any way to fix this for forward compatibility. This is to be considered as a bug of existing code, which cannot be worked around in any acceptable way. rB15189baa5231 only prevents us from hitting the same problem in the future.