Blender crashes when trying to copy a PointerProperty to selected objects #73336

Closed
opened 2020-01-23 06:58:16 +01:00 by Dion Moult · 13 comments

System Information
Operating system: Windows 10

Blender Version
Broken: 2.81 stable

Short description of error
When you have a PointerProperty shown in a panel, if you try to copy to selected, Blender will crash.

Exact steps for others to reproduce the error

  1. Start up a fresh Blender
  2. Run the following code to add a pointer property.
import bpy

class Test(bpy.types.PropertyGroup):
    foo: bpy.props.PointerProperty(name='Foo', type=bpy.types.Object)
    
class FOO_PT_object(bpy.types.Panel):
    bl_label = 'Foo Bar'
    bl_idname = 'BIM_PT_object'
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = 'object'

    @classmethod
    def poll(cls, context):
        return context.active_object is not None and hasattr(context.active_object, 'Test')

    def draw(self, context):
        row = self.layout.row()
        row.prop(context.active_object.Test, 'foo')

    
bpy.utils.register_class(Test)
bpy.utils.register_class(FOO_PT_object)
bpy.types.Object.Test = bpy.props.PointerProperty(type=Test)
  1. Duplicate the default cube a few times and set the Foo property on one of the cubes.
  2. Select another few cubes, then right click on the Foo property and try Copy to Selected
  3. Blender crashes.

#73336.blend

**System Information** Operating system: Windows 10 **Blender Version** Broken: 2.81 stable **Short description of error** When you have a PointerProperty shown in a panel, if you try to copy to selected, Blender will crash. **Exact steps for others to reproduce the error** 1. Start up a fresh Blender 2. Run the following code to add a pointer property. ``` import bpy class Test(bpy.types.PropertyGroup): foo: bpy.props.PointerProperty(name='Foo', type=bpy.types.Object) class FOO_PT_object(bpy.types.Panel): bl_label = 'Foo Bar' bl_idname = 'BIM_PT_object' bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = 'object' @classmethod def poll(cls, context): return context.active_object is not None and hasattr(context.active_object, 'Test') def draw(self, context): row = self.layout.row() row.prop(context.active_object.Test, 'foo') bpy.utils.register_class(Test) bpy.utils.register_class(FOO_PT_object) bpy.types.Object.Test = bpy.props.PointerProperty(type=Test) ``` 3. Duplicate the default cube a few times and set the `Foo` property on one of the cubes. 4. Select another few cubes, then right click on the `Foo` property and try `Copy to Selected` 5. Blender crashes. [#73336.blend](https://archive.blender.org/developer/F8296943/T73336.blend)
Author

Added subscriber: @Moult

Added subscriber: @Moult

Added subscriber: @intracube

Added subscriber: @intracube
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Confirmed, checking...

Confirmed, checking...
Member

Added subscriber: @mont29

Added subscriber: @mont29
Member

I guess this is for @mont29, this works seems related:
1cab3be7a7
ba10cd4922

Crash first looks like it is only relating to reports [reports is passed as NULL, so cannot really work here], but even if reports are left out Copy To Selected wont work (the PointerProperties are not set on the targets)...
I think the problem already starts in RNA_property_copy where rna_ensure_property_realdata will return IDProperty but is treated like PropertyRNA (so looks like pointer property is read as boolean property...)
@mont29: does this need some RNA_MAGIC treatment somewhere along the way?

1  RNA_property_pointer_set              rna_access.c                  3769  0x36e3af3 
2  rna_property_override_apply_default   rna_rna.c                     2437  0x3818e51 
3  rna_property_override_operation_apply rna_access_compare_override.c 555   0x36ef35a 
4  RNA_property_copy                     rna_access_compare_override.c 171   0x36ee77c 
5  copy_to_selected_button               interface_ops.c               965   0x3df9211 
6  copy_to_selected_button_exec          interface_ops.c               993   0x3df9301 
7  wm_operator_invoke                    wm_event_system.c             1269  0x32886ac 
8  wm_operator_call_internal             wm_event_system.c             1504  0x3288e92 
9  WM_operator_name_call_ptr             wm_event_system.c             1518  0x3288f4f 
10 ui_apply_but_funcs_after              interface_handlers.c          877   0x3dc625e 
11 ui_popup_handler                      interface_handlers.c          10748 0x3ddfb3b 
12 wm_handler_ui_call                    wm_event_system.c             617   0x3286ce0 
13 wm_handlers_do_intern                 wm_event_system.c             2543  0x328b8ca 
14 wm_handlers_do                        wm_event_system.c             2789  0x328c57c 
15 wm_event_do_handlers                  wm_event_system.c             3168  0x328d766 
16 WM_main                               wm.c                          417   0x328213b 
17 main                                  creator.c                     518   0x2fb5396 
I guess this is for @mont29, this works seems related: 1cab3be7a7 ba10cd4922 Crash first looks like it is only relating to reports [reports is passed as NULL, so cannot really work here], but even if reports are left out `Copy To Selected` wont work (the PointerProperties are not set on the targets)... I think the problem already starts in `RNA_property_copy` where `rna_ensure_property_realdata` will return `IDProperty` but is treated like `PropertyRNA` (so looks like pointer property is read as boolean property...) @mont29: does this need some `RNA_MAGIC` treatment somewhere along the way? ``` 1 RNA_property_pointer_set rna_access.c 3769 0x36e3af3 2 rna_property_override_apply_default rna_rna.c 2437 0x3818e51 3 rna_property_override_operation_apply rna_access_compare_override.c 555 0x36ef35a 4 RNA_property_copy rna_access_compare_override.c 171 0x36ee77c 5 copy_to_selected_button interface_ops.c 965 0x3df9211 6 copy_to_selected_button_exec interface_ops.c 993 0x3df9301 7 wm_operator_invoke wm_event_system.c 1269 0x32886ac 8 wm_operator_call_internal wm_event_system.c 1504 0x3288e92 9 WM_operator_name_call_ptr wm_event_system.c 1518 0x3288f4f 10 ui_apply_but_funcs_after interface_handlers.c 877 0x3dc625e 11 ui_popup_handler interface_handlers.c 10748 0x3ddfb3b 12 wm_handler_ui_call wm_event_system.c 617 0x3286ce0 13 wm_handlers_do_intern wm_event_system.c 2543 0x328b8ca 14 wm_handlers_do wm_event_system.c 2789 0x328c57c 15 wm_event_do_handlers wm_event_system.c 3168 0x328d766 16 WM_main wm.c 417 0x328213b 17 main creator.c 518 0x2fb5396 ```
Bastien Montagne self-assigned this 2020-01-23 22:29:55 +01:00

@lichtwerk not really related to those commits, no… Also, all BKE_report API in Blender supports a NULL report pointer, it just prints error message to system console then. ;)

To summarize, issue is in assigning code of RNA_pointer properties, when IDProps are involved. Made some progresses already, but after several hours am still not fully done with this… IDProps and RNA are already a nightmare, but for some reasons ID pointers IDProps are even more nightmarish. :(

@lichtwerk not really related to those commits, no… Also, all BKE_report API in Blender supports a NULL report pointer, it just prints error message to system console then. ;) To summarize, issue is in assigning code of RNA_pointer properties, when IDProps are involved. Made some progresses already, but after several hours am still not fully done with this… IDProps and RNA are already a nightmare, but for some reasons ID pointers IDProps are even more nightmarish. :(

This issue was referenced by 316d2c1522

This issue was referenced by 316d2c15220d35a9b74b15f940c45ce8d8a09288

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Author

@mont29 sorry to bother - I've just tried this with blender-2.83.3-linux64 and I still get the crash. Did I miss something? Can somebody confirm? (@lichtwerk)

@mont29 sorry to bother - I've just tried this with blender-2.83.3-linux64 and I still get the crash. Did I miss something? Can somebody confirm? (@lichtwerk)

@Moult 2.83 is crashing for me too, but not 2.90 or current master, can you please confirm that?

@Moult 2.83 is crashing for me too, but not 2.90 or current master, can you please confirm that?
Author

@mont29 you are absolutely correct :) It works on 2.90. I did not test master. All good - please disregard my comments then :)

@mont29 you are absolutely correct :) It works on 2.90. I did not test master. All good - please disregard my comments then :)
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
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
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#73336
No description provided.