Fix #127691: Crash assigning null to active attribute #127744

Closed
Pratik Borhade wants to merge 1 commits from PratikPB2123:127691-colattr-crash into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

This is due to missing null check

This is due to missing null check
Pratik Borhade added 1 commit 2024-09-17 07:53:53 +02:00
Pratik Borhade requested review from Hans Goudey 2024-09-17 07:54:17 +02:00
Author
Member

or maybe we could use PROP_NEVER_NULL flag?

or maybe we could use `PROP_NEVER_NULL` flag?
Pratik Borhade changed title from Fix #127691: Crash assigning null to active_color to Fix #127691: Crash assigning null to active attribute 2024-09-17 07:55:43 +02:00
Contributor

or maybe we could use PROP_NEVER_NULL flag?

But they can be null:
C.object.data.attributes.active_color in new project's Cube is None.
C.object.data.attributes.active is also can be None - e.g. when you remove some attribute from UI then attributes.active becomes None until user selects some other one.

> or maybe we could use `PROP_NEVER_NULL` flag? But they can be null: `C.object.data.attributes.active_color` in new project's Cube is `None`. `C.object.data.attributes.active` is also can be `None` - e.g. when you remove some attribute from UI then `attributes.active` becomes `None` until user selects some other one.
Author
Member

So I assume current fix is correct?

So I assume current fix is correct?
Hans Goudey reviewed 2024-09-17 21:26:17 +02:00
Hans Goudey left a comment
Member

I think it might be simpler to allow having no active attribute. That already happens in some cases currently.

For the color attributes, I think it would be better to free the attribute name stored on the mesh.

For the active attribute, it might be good to check if there's a proper "not set" value. Maybe setting the active attribute index to -1 or something could represent this state.

I think it might be simpler to allow having no active attribute. That already happens in some cases currently. For the color attributes, I think it would be better to free the attribute name stored on the mesh. For the active attribute, it might be good to check if there's a proper "not set" value. Maybe setting the active attribute index to `-1` or something could represent this state.

Agree "no active" being represented by -1 makes sense, checking geometry_attribute_remove_exec it looks like this is currently avoided (never below zero), but that can be changed.

Agree "no active" being represented by -1 makes sense, checking `geometry_attribute_remove_exec` it looks like this is currently avoided (never below zero), but that can be changed.

Submitted an alternate patch which supports clearing the active layer: #128233.

Submitted an alternate patch which supports clearing the active layer: #128233.
Author
Member

Thanks, I'll close this PR.

Thanks, I'll close this PR.
Pratik Borhade closed this pull request 2024-09-27 12:22:10 +02:00
Pratik Borhade deleted branch 127691-colattr-crash 2024-09-27 12:23:24 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
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#127744
No description provided.