Crash updating string custom property with frame_change handler #37073

Closed
opened 2013-10-14 17:32:38 +02:00 by Jason van Gumster · 8 comments

%%%--- Blender version with error, and version that worked ---
SVN r60747

- Short description of error ---

If you set up a frame_change_pre handler that updates a custom string property based on the current frame value, Blender will crash if you move the mouse cursor over the custom property's panel in the Properties editor. Example .blend and gdb backtrace attached.

- Steps for others to reproduce the error (preferably based on attached .blend file) ---
  1. Open the attached .blend file and run the script in the Text Editor.
  2. Go to the 3D View and play back the animation (Alt+A).
  3. Move the mouse cursor to the bottom of the Properties Editor, specifically "MyString" custom property
  4. Witness crashage.%%%
%%%--- Blender version with error, and version that worked --- SVN r60747 - Short description of error --- If you set up a frame_change_pre handler that updates a custom string property based on the current frame value, Blender will crash if you move the mouse cursor over the custom property's panel in the Properties editor. Example .blend and gdb backtrace attached. - Steps for others to reproduce the error (preferably based on attached .blend file) --- 1. Open the attached .blend file and run the script in the Text Editor. 2. Go to the 3D View and play back the animation (Alt+A). 3. Move the mouse cursor to the bottom of the Properties Editor, specifically "MyString" custom property 4. Witness crashage.%%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'

%%%Just small addition: you need to run the script before playback :)%%%

%%%Just small addition: you need to run the script before playback :)%%%
Member

%%%General issue here is that the button stores the IDProperty string pointer, which turns invalid when setting the string (and is not immediately redrawn).%%%

%%%General issue here is that the button stores the IDProperty string pointer, which turns invalid when setting the string (and is not immediately redrawn).%%%
Member

%%%Correction: The problem is not simply the string value (this is not actually stored in string buttons), but the uiBut->rnaprop pointer. For regular RNA props it can be relied upon insofar as these PropertyRNA pointers stay valid. But in the case of plain IDProperties the "rnaprop" pointer is actually an IDProperty*, with the MAGIC flag set to tell them apart (common RNA hack). However, IDProperties do get freed when replacing their values, which invalidates but->rnaprop.%%%

%%%Correction: The problem is not simply the string value (this is not actually stored in string buttons), but the uiBut->rnaprop pointer. For regular RNA props it can be relied upon insofar as these PropertyRNA pointers stay valid. But in the case of plain IDProperties the "rnaprop" pointer is actually an IDProperty*, with the MAGIC flag set to tell them apart (common RNA hack). However, IDProperties do get freed when replacing their values, which invalidates but->rnaprop.%%%
Campbell Barton was assigned by Sergey Sharybin 2013-12-04 16:24:26 +01:00

Added subscriber: @ideasman42

Added subscriber: @ideasman42

@ideasman42, can you please check this report? You're the most familiar with custom props and so..

@ideasman42, can you please check this report? You're the most familiar with custom props and so..
Member

Discussed this with Campbell on IRC a while back. IIRC our conclusion was that forcing a redraw when changing ID properties is the easiest solution for now, although not really nice.

Alternatively we'd need a safe way of referencing IDProperty from buttons instead of just storing a pointer and hoping for the best. This would probably be a lot of work, considering how many functions access these pointers.

Discussed this with Campbell on IRC a while back. IIRC our conclusion was that forcing a redraw when changing ID properties is the easiest solution for now, although not really nice. Alternatively we'd need a safe way of referencing IDProperty from buttons instead of just storing a pointer and hoping for the best. This would probably be a lot of work, considering how many functions access these pointers.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#37073
No description provided.