BMain locking during the 'after liblink' doversion #92333

Open
opened 2021-10-19 09:49:29 +02:00 by Bastien Montagne · 5 comments

in 6a850f3cc8, Main.is_locked_for_linking was added, and is currently only used in versioning code (both before and after liblink), to prevent adding or deleting IDs from Main.

However, exceptions have already been added to allow creation of workspaces and collections in that context. And {D12722#inline-108272} adds nodetrees to the exceptions.

Problem

While preventing before-liblink doversion to add or remove any ID makes total sense, I do not understand why after-liblink doversion should have this constraint.

To me the bug fixed by the commit is a bug in the (removed) doversion code, not something inherently forbidden at this stage?

Proposed Solution

Remove that lock check altogether in after-liblink doversion.

I think however that we could use that lock on all other Mains besides the one being processed (to ensure doversion code does not create/delete things outside its own scope). And do-version code there should be smart enough to check when it runs on the local main, or a lib main, and adapt its code accordingly.

Another thing to fix is in BKE_libblock_alloc, which should assign main->curlib to the newly created ID's id->lib (and tag it as indirectly linked). That way if doversion needs to create an ID in a library context, that new ID is properly created as a 'virtual' indirectly linked data, and does not break Main consistency (even if doing stupid things like generating default brushes for a lib main). Done in 7681326acd

in 6a850f3cc8, `Main.is_locked_for_linking` was added, and is currently only used in versioning code (both before and after liblink), to prevent adding or deleting IDs from Main. However, exceptions have already been added to allow creation of workspaces and collections in that context. And {[D12722](https://archive.blender.org/developer/D12722)#inline-108272} adds nodetrees to the exceptions. Problem ---------- While preventing before-liblink doversion to add or remove any ID makes total sense, I do not understand why after-liblink doversion should have this constraint. To me the bug fixed by the commit is a bug in the (removed) doversion code, not something inherently forbidden at this stage? Proposed Solution --------------------- Remove that lock check altogether in after-liblink doversion. I think however that we could use that lock on all other Mains besides the one being processed (to ensure doversion code does not create/delete things outside its own scope). And do-version code there should be smart enough to check when it runs on the local main, or a lib main, and adapt its code accordingly. ~~Another thing to fix is in `BKE_libblock_alloc`, which should assign `main->curlib` to the newly created ID's `id->lib` (and tag it as indirectly linked). That way if doversion needs to create an ID in a library context, that new ID is properly created as a 'virtual' indirectly linked data, and does not break Main consistency (even if doing stupid things like generating default brushes for a lib main).~~ Done in 7681326acd
Author
Owner

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

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

Added subscriber: @mont29

Added subscriber: @mont29
Author
Owner

Added subscribers: @brecht, @ideasman42

Added subscribers: @brecht, @ideasman42
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Philipp Oeser removed the
Interest
Core
label 2023-02-09 14:42:54 +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
3 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#92333
No description provided.