fix for long standing problem with blender 2.5x py api.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 1 Nov 2012 15:56:42 +0000 (15:56 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 1 Nov 2012 15:56:42 +0000 (15:56 +0000)
commitf4e5404e4ae1bf0c5c45220f87e981fbc4c3ab98
treeff46e4486c2c137aff2cd5196835d21bd5376b7d
parent818e9ff88d84f85ad729b8d7839ead21568cff20
fix for long standing problem with blender 2.5x py api.
Removing data then accessing would allow invalid memory access and often crash.

Example:
  import bpy
  image = bpy.data.images.new(name="a", width=5, height=5)
  bpy.data.images.remove(image)
  print(image.name)

Now access to the removed data raises an error:
  ReferenceError: StructRNA of type Image has been removed

This is the same level of error checking that was done in blender 2.4x but was made difficult by RNA functions not having access to the PyObject's.
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/python/intern/bpy_rna.c