context.annotation_data isn't set to nullptr when the last annotation layer is deleted #112683
Labels
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#112683
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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
Operating system: Windows 10 Pro
Graphics card: NVIDIA GeForce GTX 1060 3GB/PCIe/SSE2
Blender Version
Broken: 3.6.2, branch: blender-v3.6-release, commit date: 2023-08-16 16:43, hash:
e53e55951e
, type: releaseShort description of error
When the last Annotation layer is deleted from the list, there are warnings printed out to the console on each viewport update.
Looks like context.annotation_data isn't set to nullptr when the last annotation layer is deleted.
Exact steps for others to reproduce the error
WARN (bpy.rna): D:\Work\Projects\blender-git\blender\source\blender\python\intern\bpy_rna.cc:1349 pyrna_enum_to_py: current value '-1' matches no enum in 'GreasePencilLayers', '(null)', 'active_note'
I'm already looking into this.
Can reproduce on 3.6.2 and 4.0. The error will be printed any time the tool options header updates, suggesting somewhere in the UI script it needs to handle a null-layer situation.
The UI script seems to handle null-layer situation well, but it seems that after deleting the last layer the annotation data bGPdata in C code hasn't been freed and that the script can still access it.
If I print messages in _defs_annotate.draw_settings_common like so:
Initially, when I select the annotation tool, only the first message is printed ("in draw_settings_common").
When I draw something, all three messages are printed.
But when I delete the last layer, all three messages still get printed out (together with that warning), meaning that the bGPdata hasn't been freed and the pointer set to null.
When I do this at the end of gpencil_layer_remove_exec():
... the problem disappears, but I leak memory. I'll just need to figure out how to free everything properly (I'm new to the code base so it's not that obvious what I need to do, but I'll manage).
And this can be backported to 3.6?
I believe so, but I'm not familiar with the procedure. @PratikPB2123?
Thanks, added in both 3.3-3.6 backporting lists: #109399 / #100749