UI widget for pointer property with custom type causes segmentation fault #52735
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#52735
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Ubuntu 17.04 64 bit + Win 10 64 bit
Blender Version
Broken: 2.79
Short description of error
Creating a UI widget to edit a pointer property that was created with type specified as a subclass of bpy.types.ID declared in Python (rather than one of the pre-existing subclasses) causes a segmentation fault when trying to edit.
Exact steps for others to reproduce the error
Run the following script. Editing the first property in the popup (points to bpy.types.NodeTree) acts as expected. Editing the second property in the popup (points to bpy.types.TestTreeType) causes a segmentation fault.
Changed status to: 'Open'
Added subscriber: @PeterNoble
Added subscribers: @mont29, @Sergey
@mont29, is it something related on recent ID custom properties implemented for 2.79?
@Sergey yes, but… wait… since when is it valid to subclass an ID type? Subclassing ID types in Python… who ever allowed such an evil scheme? :((((((
This is for sure not going to work with ID custom props, not with current code anyway…
type
here shall always be real ID one, not some fancy py subclassing. Will check on code, this should be possible to validate at prop definition time.@mont29, isn't it how custom node trees are supposed to work? You kind of subclass there.
Would be nice to at least prevent crashes, perhaps.
Added subscriber: @ideasman42
Ok… still, don’t think that was a good idea, like, at all… ID types are not virtual stuff like operators or render engines, they are data, stored in Blender file, they are kind of root of everything in Blender, so faking their subclassing in py sounds like a nice can of worms to me… Would have been so much cleaner to have registrable NodeTreeType classes instead! Anyway…
Crash happens because automated search button generation code (
ui_but_add_search()
) cannot find a proper ID collection for the type of subclassed nodetree, and hence does not callUI_but_func_search_set()
for created button, which later when entering 'edit mode' of that button tries to callbut->search_create_func()
, which is NULL.So we actually have two issues here, one fail in UI code to safely handle case where searchprop of a searchmenu is not valid (will fix, it's pretty trivial).
And the subclass-of-real-ID case, here I would just forbid any non-real-ID class… and curse to death that very idea of ID subclassing! :( @ideasman42 may have better ideas here though?
Maybe I've got the wrong idea but the impression I got was that this change to PointerProperty was useful because it allowed search boxes to be more specific than just materials, objects, node trees etc... I can't think of any reason the user would ever need a search box that allows selecting of all node tree types but it would be useful to only allow a specific type of node group.
Other than the UI bit it acts as expected when using the PointerProperty from other Python code. It allows data blocks of the correct type to be assigned and in this case, for example, it doesn't allow a node group that isn't of type TestTreeType.
Added subscriber: @BYOB
I recently stumbled about this bug as well, so I can confirm it.
I avoid the crash by setting the type to
PointerProperty(type=bpy.types.NodeTree)
, but then a user gets a dropdown where he can select any type of nodetree in the scene.Basically the same issue:
But that's slightly offtopic I guess.
Added subscriber: @Blendify
Changed status from 'Confirmed' to: 'Resolved'
This should be fixed