Only search projects.blender.org
Log In
New Account
Home
My Page
Projects
Blender 2.x BF release
Summary
Activity
Tracker
SCM
Files
Blender 2.6 Bug Tracker: Browse
[#27793] Python update-Callback infinite recursion
Date:
2011-06-28 12:50
Priority:
3
State:
Closed
Submitted by:
Christian Lenke (
zphr3000
)
Assigned to:
Campbell Barton (campbellbarton)
Category:
Python
Status:
Rejected / Closed
Relates to:
Duplicates:
Patches:
Summary:
Python update-Callback infinite recursion
Detailed description
Hi,
OS: Windows 7 64bit
3D-Card: Nvidia GTX 560
Blender Version: 2.58 r37724
the new update-callbacks for python go into a (indirect) recursion
if the variable which called the update-callback is changed within the update-callback.
The following example crashes if the String- and IntProperty are changed.
If the StringProperty is substituted with a FloatProperty or if only the StringProperty is changed
it doesnt crash.
import bpy
def func(self, context):
bpy.context.scene.my_settings.my_int = 2
bpy.context.scene.my_settings.my_string = "crash"
class MaterialSettings(bpy.types.PropertyGroup):
my_int = bpy.props.IntProperty(update=func)
my_string = bpy.props.StringProperty(update=func)
bpy.utils.register_class(MaterialSettings)
bpy.types.Scene.my_settings = \
bpy.props.PointerProperty(type=MaterialSettings)
bpy.context.scene.my_settings.my_string = "start"
bpy.context.scene.my_settings.my_int = 2
Followup
Message
Date
: 2011-07-10 15:56
Sender
:
Ton Roosendaal
Assigning to campbell, he's with holidays now so it'll take a week or more.
Date
: 2011-12-02 16:28
Sender
:
Sergey Sharybin
Campbell, do you have any progress here? :)
Date
: 2012-09-28 11:36
Sender
:
Campbell Barton
Thinking about this, a property update function should remain low level, IMHO its reasonable to have users responsible for not getting into problematic situations where infinite recursion happens, Added note to docs saying this.
closing.
Attached Files:
Name
Date
Download
callback_recursion.py
2011-06-28 12:50
Download
Changes:
Field
Old Value
Date
By
status_id
Open
2012-09-28 11:36
campbellbarton
close_date
None
2012-09-28 11:36
campbellbarton
details
Hi, OS: Windows 7 64bit 3D-Card: Nvidia GTX 560 Blender Version: 2.58 r37724 the new update-callbacks for python go into a (indirect) recursion if the variable which called the update-callback is changed within the update-callback. The following example crashes if the String- and IntProperty are changed. If the StringProperty is substituted with a FloatProperty or if only the StringProperty is changed it doesnt crash. import bpy def func(self, context): bpy.context.scene.my_settings.my_int = 2 bpy.context.scene.my_settings.my_string = "crash" class MaterialSettings(bpy.types.PropertyGroup): my_int = bpy.props.IntProperty(update=func) my_string = bpy.props.StringProperty(update=func) bpy.utils.register_class(MaterialSettings) bpy.types.Scene.my_settings = \\ bpy.props.PointerProperty(type=MaterialSettings) bpy.context.scene.my_settings.my_string = "start" bpy.context.scene.my_settings.my_int = 2
2012-09-28 11:36
campbellbarton
Status
Investigate
2012-09-28 11:36
campbellbarton
details
Hi, OS: Windows 7 64bit 3D-Card: Nvidia GTX 560 Blender Version: 2.58 r37724 the new update-callbacks for python go into a (indirect) recursion if the variable which called the update-callback is changed within the update-callback. The following example crashes if the String- and IntProperty are changed. If the StringProperty is substituted with a FloatProperty or if only the StringProperty is changed it doesnt crash. import bpy def func(self, context): bpy.context.scene.my_settings.my_int = 2 bpy.context.scene.my_settings.my_string = "crash" class MaterialSettings(bpy.types.PropertyGroup): my_int = bpy.props.IntProperty(update=func) my_string = bpy.props.StringProperty(update=func) bpy.utils.register_class(MaterialSettings) bpy.types.Scene.my_settings = \\ bpy.props.PointerProperty(type=MaterialSettings) bpy.context.scene.my_settings.my_string = "start" bpy.context.scene.my_settings.my_int = 2
2011-12-02 16:28
nazgul
assigned_to
none
2011-07-10 15:56
ton
details
Hi, OS: Windows 7 64bit 3D-Card: Nvidia GTX 560 Blender Version: 2.58 r37724 the new update-callbacks for python go into a (indirect) recursion if the variable which called the update-callback is changed within the update-callback. The following example crashes if the String- and IntProperty are changed. If the StringProperty is substituted with a FloatProperty or if only the StringProperty is changed it doesnt crash. import bpy def func(self, context): bpy.context.scene.my_settings.my_int = 2 bpy.context.scene.my_settings.my_string = "crash" class MaterialSettings(bpy.types.PropertyGroup): my_int = bpy.props.IntProperty(update=func) my_string = bpy.props.StringProperty(update=func) bpy.utils.register_class(MaterialSettings) bpy.types.Scene.my_settings = \\ bpy.props.PointerProperty(type=MaterialSettings) bpy.context.scene.my_settings.my_string = "start" bpy.context.scene.my_settings.my_int = 2
2011-07-10 15:56
ton
Status
New
2011-07-10 15:56
ton
File Added
16888: callback_recursion.py
2011-06-28 12:50
zphr3000