Assert using PropertyGroup and PointerProperty prop in Panel #96503

Closed
opened 2022-03-15 19:37:31 +01:00 by Antonio Vazquez · 18 comments

Windows version compiled at 15/03/2022 18:00

Using an add-on that displays some props, a assert rises. The add-on was working without modifications since today compilation, but maybe failed for several days.

Important: Assert only visible in Debug mode.

To reproduce:

  1. Install simple add-on attached.
  2. Enable add-on
  3. Go to panel
  4. Assert

Add-on
bug.zip

2022-03-15 19-36-52.mp4

Error: BLI_assert failed: D:\MyBlender\BlenderDEV\blender\source\blender\makesrna\intern\rna_access.c:5534, rna_idp_path(), at '!RNA_pointer_is_null(&child_ptr)

Windows version compiled at 15/03/2022 18:00 Using an add-on that displays some props, a assert rises. The add-on was working without modifications since today compilation, but maybe failed for several days. Important: Assert only visible in Debug mode. To reproduce: 1) Install simple add-on attached. 2) Enable add-on 3) Go to panel 4) Assert Add-on [bug.zip](https://archive.blender.org/developer/F12932031/bug.zip) [2022-03-15 19-36-52.mp4](https://archive.blender.org/developer/F12929017/2022-03-15_19-36-52.mp4) Error: `BLI_assert failed: D:\MyBlender\BlenderDEV\blender\source\blender\makesrna\intern\rna_access.c:5534, rna_idp_path(), at '!RNA_pointer_is_null(&child_ptr)`
Author
Member

Added subscriber: @antoniov

Added subscriber: @antoniov
Author
Member

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel
Author
Member

@JulianEisel This is the task we were talking about for the RNA assert.

@JulianEisel This is the task we were talking about for the RNA assert.
Author
Member

Added subscriber: @SimonThommes

Added subscriber: @SimonThommes

Added subscriber: @iss

Added subscriber: @iss

Perhaps I am doing something wrong, but can't reproduce issue here.

Perhaps I am doing something wrong, but can't reproduce issue here.
Author
Member

@iss Are you on Windows with a Debug compilation? Really, it's hard to reproduce, in my PC was working normally and yesterday started..also some Blender Studio users started to find it. I tried a fresh build from February 1st and the bug was still there...very weird.

@iss Are you on Windows with a Debug compilation? Really, it's hard to reproduce, in my PC was working normally and yesterday started..also some Blender Studio users started to find it. I tried a fresh build from February 1st and the bug was still there...very weird.
Member

I'm able to reproduce on Linux, this looks like the same issue that I was having.

I'm able to reproduce on Linux, this looks like the same issue that I was having.
Author
Member

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

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

As we can reproduce on Linux (Simon) and Windows we can be sure is not a Windows compiler only issue.

As we can reproduce on Linux (Simon) and Windows we can be sure is not a Windows compiler only issue.
Author
Member

@JulianEisel Do we need to tag this error as Core or maybe is Python API?

@JulianEisel Do we need to tag this error as `Core` or maybe is `Python API`?
Antonio Vazquez changed title from Assert using prop in Panel to Assert using PropertyGroup prop in Panel 2022-03-16 17:28:32 +01:00
Author
Member

I have narrowed down the cause of the error. The error occurs only when using a PropertyGroup and is defined in the scene as PointerProperty

If the prop is not a propertygroup, works.

class bug_settings(PropertyGroup):
    prev_color: FloatVectorProperty(name="Prev Color",
                                    description="Color for previous frame",
                                    default=(0.045, 0.406, 0.040, 0.2),
                                    min=0.1,
                                    max=1,
                                    subtype='COLOR',
                                    size=4)


class BUG_PT_MainPanel(Panel):
    bl_label = "Bug"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "My Bug"

    def draw(self, context):
        layout = self.layout
        settings = context.scene.bug_settings

        row = layout.row()
        row.prop(context.scene, 'my_bool', text="My Boolean") # <<<<<<<<<<<<<<<< Works
        row.prop(settings, 'prev_color', text="")  # <<<<<<<<<<<<<<<<<<<<<< CRASH!!!!

Settings are defines in register as:

def register():
    from bpy.utils import register_class
    for cls in classes:
        register_class(cls)

    Scene.bug_settings = PointerProperty(type=bug_settings)
    Scene.my_bool = BoolProperty(name="Test",
                                 description="Test prop",
                                 default=False)
I have narrowed down the cause of the error. The error occurs only when using a `PropertyGroup` and is defined in the `scene` as `PointerProperty` If the prop is not a propertygroup, works. ``` class bug_settings(PropertyGroup): prev_color: FloatVectorProperty(name="Prev Color", description="Color for previous frame", default=(0.045, 0.406, 0.040, 0.2), min=0.1, max=1, subtype='COLOR', size=4) class BUG_PT_MainPanel(Panel): bl_label = "Bug" bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = "My Bug" def draw(self, context): layout = self.layout settings = context.scene.bug_settings row = layout.row() row.prop(context.scene, 'my_bool', text="My Boolean") # <<<<<<<<<<<<<<<< Works row.prop(settings, 'prev_color', text="") # <<<<<<<<<<<<<<<<<<<<<< CRASH!!!! ``` Settings are defines in `register` as: ``` def register(): from bpy.utils import register_class for cls in classes: register_class(cls) Scene.bug_settings = PointerProperty(type=bug_settings) Scene.my_bool = BoolProperty(name="Test", description="Test prop", default=False) ```
Author
Member

Following with the investigation of the bug I have found that the assert is only when you have several add-ons using PointerProperty. If you have only one add-on, then never fails.

Following with the investigation of the bug I have found that the assert is only when you have several add-ons using `PointerProperty`. If you have only one add-on, then never fails.
Antonio Vazquez changed title from Assert using PropertyGroup prop in Panel to Assert using PropertyGroup and PointerProperty prop in Panel 2022-03-16 20:00:37 +01:00
Author
Member

After more testing the problem is when you have a PointerProperty defined.

This is the python I used to test (no need more add-ons to crash)

bl_info = {
    "name": "Bug test",
    "description": "Bug test",
    "author": "Antonio Vazquez",
    "version": (0, 0, 0),
    "blender": (3, 2, 0),
    "location": "Sidebar",
    "warning": "Experimental",
    "category": "Object",
}

import bpy
from bpy.types import (
    Scene,
    Panel,
    PropertyGroup,
    WorkSpace,
)
from bpy.props import (
    BoolProperty,
    FloatVectorProperty,
    PointerProperty,
)


class bug_settings(PropertyGroup):
    prev_color: FloatVectorProperty(name="Prev Color",
                                    description="Color for previous frame",
                                    default=(0.045, 0.406, 0.040, 0.2),
                                    min=0.1,
                                    max=1,
                                    subtype='COLOR',
                                    size=4)


class BUG_PT_MainPanel(Panel):
    bl_label = "Bug"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "My Bug"

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        settings = scene.my_settings

        row = layout.row()
        row.prop(context.scene, 'my_pointer', text="Workspace")
        row.prop(context.scene, 'my_bool', text="My Boolean")
        row.prop(settings, 'prev_color', text="")


classes = (
    bug_settings,
    BUG_PT_MainPanel,
)

def register():
    from bpy.utils import register_class
    for cls in classes:
        register_class(cls)
    Scene.my_pointer = PointerProperty(type=WorkSpace, description="Workspace")

    Scene.my_settings = PointerProperty(type=bug_settings)
    Scene.my_bool = BoolProperty(name="Test",
                                 description="Test prop",
                                 default=False)

def unregister():
    from bpy.utils import unregister_class
    for cls in reversed(classes):
        unregister_class(cls)

    del Scene.my_settings
    del Scene.my_bool
    del Scene.my_pointer

if __name__ == '__main__':
    register()

And this is the video of the crash using the Outliner

2022-03-16 22-27-32.mp4

Doing a debug in C, the error is in the function rna_idp_path when try to find the pointer in line 5533 PointerRNA child_ptr = RNA_property_pointer_get(ptr, prop);

After more testing the problem is when you have a `PointerProperty` defined. This is the python I used to test (no need more add-ons to crash) ``` bl_info = { "name": "Bug test", "description": "Bug test", "author": "Antonio Vazquez", "version": (0, 0, 0), "blender": (3, 2, 0), "location": "Sidebar", "warning": "Experimental", "category": "Object", } import bpy from bpy.types import ( Scene, Panel, PropertyGroup, WorkSpace, ) from bpy.props import ( BoolProperty, FloatVectorProperty, PointerProperty, ) class bug_settings(PropertyGroup): prev_color: FloatVectorProperty(name="Prev Color", description="Color for previous frame", default=(0.045, 0.406, 0.040, 0.2), min=0.1, max=1, subtype='COLOR', size=4) class BUG_PT_MainPanel(Panel): bl_label = "Bug" bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = "My Bug" def draw(self, context): layout = self.layout scene = context.scene settings = scene.my_settings row = layout.row() row.prop(context.scene, 'my_pointer', text="Workspace") row.prop(context.scene, 'my_bool', text="My Boolean") row.prop(settings, 'prev_color', text="") classes = ( bug_settings, BUG_PT_MainPanel, ) def register(): from bpy.utils import register_class for cls in classes: register_class(cls) Scene.my_pointer = PointerProperty(type=WorkSpace, description="Workspace") Scene.my_settings = PointerProperty(type=bug_settings) Scene.my_bool = BoolProperty(name="Test", description="Test prop", default=False) def unregister(): from bpy.utils import unregister_class for cls in reversed(classes): unregister_class(cls) del Scene.my_settings del Scene.my_bool del Scene.my_pointer if __name__ == '__main__': register() ``` And this is the video of the crash using the Outliner [2022-03-16 22-27-32.mp4](https://archive.blender.org/developer/F12930685/2022-03-16_22-27-32.mp4) Doing a debug in C, the error is in the function `rna_idp_path` when try to find the pointer in line `5533 PointerRNA child_ptr = RNA_property_pointer_get(ptr, prop);`
Author
Member

Here the debug data and callstack

image.png

Here the debug data and callstack ![image.png](https://archive.blender.org/developer/F12930745/image.png)
Julian Eisel was assigned by Bastien Montagne 2022-03-23 09:31:06 +01:00
Julian Eisel removed their assignment 2022-04-29 15:47:30 +02:00
Member

I was only involved with this to help Simon debug the issue, I'm not planning on looking into this further currently. So I'd prefer not to be assigned to this.

I was only involved with this to help Simon debug the issue, I'm not planning on looking into this further currently. So I'd prefer not to be assigned to this.

This issue was referenced by 2397287a51

This issue was referenced by 2397287a51bf45f22b2008d17e8e89c2269d870a

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Bastien Montagne self-assigned this 2022-05-16 11:01:22 +02:00
Thomas Dinges added this to the 3.2 milestone 2023-02-08 15:51:07 +01:00
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
6 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#96503
No description provided.