Moving collections between scenes crashes Blender #82439

Closed
opened 2020-11-05 19:04:15 +01:00 by kursad k · 13 comments
Member

System Information
Operating system: Windows 10 x64
Graphics card: Gtx2070

Blender Version
Broken: blender-2.91.0-29780b8101eb-windows64
Behavior changed in 89491d67d9

Short description of error
Moving collections between internal scenes hard crashes Blender.

Exact steps for others to reproduce the error
Open the attached scene and drag and drop the the Drag_Me_2_Scene.001 from Scene to Scene.001 or take a look at the attached image

nxplayer.bin_vohdHzIRRc.jpg

collection_drag_05112020_1200_11.blend

**System Information** Operating system: Windows 10 x64 Graphics card: Gtx2070 **Blender Version** Broken: blender-2.91.0-29780b8101eb-windows64 Behavior changed in 89491d67d9 **Short description of error** Moving collections between internal scenes hard crashes Blender. **Exact steps for others to reproduce the error** Open the attached scene and drag and drop the the `Drag_Me_2_Scene.001` from Scene to Scene.001 or take a look at the attached image ![nxplayer.bin_vohdHzIRRc.jpg](https://archive.blender.org/developer/F9211148/nxplayer.bin_vohdHzIRRc.jpg) [collection_drag_05112020_1200_11.blend](https://archive.blender.org/developer/F9211153/collection_drag_05112020_1200_11.blend)
Author
Member

Added subscriber: @kursadk

Added subscriber: @kursadk

Added subscriber: @rjg

Added subscriber: @rjg

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

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

I can confirm this crash in current master and 2.91. layer_collection is NULL in layer_collection_flags_restore .

_BLI_assert_abort() Lines 51	C
layer_collection_flags_restore(ListBase * flags, const Collection * collection) Lines 1818	C
BKE_collection_move(Main * bmain, Collection * to_parent, Collection * from_parent, Collection * relative, bool relative_after, Collection * collection) Lines 1878	C
collection_drop_invoke(bContext * C, wmOperator * UNUSED_op, const wmEvent * event) Lines 1289	C
wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Lines 1288	C
wm_operator_call_internal(bContext * C, wmOperatorType * ot, PointerRNA * properties, ReportList * reports, const short context, const bool poll_only, wmEvent * event) Lines 1534	C
wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Lines 2781	C
wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Lines 2864	C
wm_event_do_handlers(bContext * C) Lines 3360	C
WM_main(bContext * C) Lines 481	C
main(int argc, const unsigned char * * UNUSED_argv_c) Lines 526	C
I can confirm this crash in current master and 2.91. `layer_collection` is `NULL` in `layer_collection_flags_restore` . ```lines _BLI_assert_abort() Lines 51 C layer_collection_flags_restore(ListBase * flags, const Collection * collection) Lines 1818 C BKE_collection_move(Main * bmain, Collection * to_parent, Collection * from_parent, Collection * relative, bool relative_after, Collection * collection) Lines 1878 C collection_drop_invoke(bContext * C, wmOperator * UNUSED_op, const wmEvent * event) Lines 1289 C wm_operator_invoke(bContext * C, wmOperatorType * ot, wmEvent * event, PointerRNA * properties, ReportList * reports, const bool poll_only, bool use_last_properties) Lines 1288 C wm_operator_call_internal(bContext * C, wmOperatorType * ot, PointerRNA * properties, ReportList * reports, const short context, const bool poll_only, wmEvent * event) Lines 1534 C wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Lines 2781 C wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Lines 2864 C wm_event_do_handlers(bContext * C) Lines 3360 C WM_main(bContext * C) Lines 481 C main(int argc, const unsigned char * * UNUSED_argv_c) Lines 526 C ```

This seems to work fine in Blender 2.83 in a cursory test.

This seems to work fine in Blender 2.83 in a cursory test.
Hans Goudey self-assigned this 2020-11-06 02:15:33 +01:00
Member

After looking at the code here it seems that it's fundamentally broken in cases where multiple scenes are involved. It basically assumes that the collection is being moved to the same view layer it's already in, because it searches in the original view layer for the moved collection.

A simple solution would be to just remove the assert and skip the collection when no view layer is found, but I feel like there should be a proper way around this. One way to solve this would be to pass the "to view layer" which would then be searched for the new LayerCollection for the collection.

However, I don't think this would deal with the case where the same collection is in two scenes at the same time. It almost looks like we would need a separate list of LayerCollectionFlags for each scene, and that putting them all in the same list isn't correct.

After looking at the code here it seems that it's fundamentally broken in cases where multiple scenes are involved. It basically assumes that the collection is being moved to the same view layer it's already in, because it searches in the original view layer for the moved collection. A simple solution would be to just remove the assert and skip the collection when no view layer is found, but I feel like there should be a proper way around this. One way to solve this would be to pass the "to view layer" which would then be searched for the new `LayerCollection` for the collection. However, I don't think this would deal with the case where the same collection is in two scenes at the same time. It almost looks like we would need a separate list of `LayerCollectionFlag`s for each scene, and that putting them all in the same list isn't correct.
Author
Member

As a side note linking via Ctrl dragging does not crash Blender.

As a side note linking via Ctrl dragging does not crash Blender.

For reference, the commit that introduced the changed/broken behavior was 89491d67d9

For reference, the commit that introduced the changed/broken behavior was 89491d67d9

Added subscriber: @mont29

Added subscriber: @mont29

@HooglyBoogly are you working on this issues?

@HooglyBoogly are you working on this issues?
Member

@mont29 I was away for a few days but I'm planning to work on this in the next day or two.

@mont29 I was away for a few days but I'm planning to work on this in the next day or two.

This issue was referenced by c645da98d8

This issue was referenced by c645da98d8727e636c14383f4c10706c6cc5ead2
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Thomas Dinges added this to the 2.91 milestone 2023-02-08 16:20:08 +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
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#82439
No description provided.