Collections: Exclude From View toggle causes segment violation. #72490
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#72490
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: Linux-5.4.0-gentoo-bertha-x86_64-Intel-R-_Xeon-R-CPU_E5-2630_v4@_2.20GHz-with-gentoo-2.6 64 Bits
Graphics card: Radeon Pro WX 9100 (VEGA10, DRM 3.35.0, 5.4.0-gentoo-bertha, LLVM 8.0.1) X.Org 4.5 (Core Profile) Mesa 19.1.8
Blender Version
Broken: version: 2.82 (sub 5), branch: master, commit date: 2019-12-16 11:53, hash:
8d16dc029e
Worked: version: 2.81 (sub 16), branch: master, commit date: 2019-11-20 14:27, hash:
26bd5ebd42
, type: ReleaseBisection point - breaking commit:
9516921c05
Author: Clément Foucault foucault.clem@gmail.com
Date: Mon Dec 2 01:40:58 2019 +0100 Overlay Engine: Refactor & Cleanup
Short description of error
Unchecking, then rechecking a collection's Exclude from View checkbox, containing one mesh object in initially in Edit Mode, crashes Blender. However, to reliably reproduce the crash, follow the exact steps here. Deselecting the mesh object, or switching to object mode (or any other mode) seems to bypass the issue.
[Edit: note critical typo in original]
Exact steps for others to reproduce the error
unchecked.picture 1: 1D
picture 2: 3
colselect.blend
colselect.blend
Backtrace
0x0000555578321039 in drw_command_create (shgroup=0x0, type=DRW_CMD_SELECTID) at
609 DRWCommandChunk *chunk = shgroup->cmd.last;
#0 0x0000555578321039 in drw_command_create (shgroup=0x0, type=DRW_CMD_SELECTID) at
#1 0x0000555578322230 in drw_command_set_select_id (shgroup=0x0, buf=0x0, select_id=1) at
#2 0x0000555578322ac0 in DRW_shgroup_call_ex (shgroup=0x0, ob=0x61b0003185b8, obmat=0x0, geom=0x6110007d8138, bypass_culling=true,
#3 0x00005555784ada10 in overlay_edit_mesh_add_ob_to_pass (pd=0x61c00026d8b8, ob=0x61b0003185b8, in_front=false) at
#4 0x00005555784ae749 in OVERLAY_edit_mesh_cache_populate (vedata=0x61700029ddb8, ob=0x61b0003185b8) at
#5 0x00005555784a0ede in OVERLAY_cache_populate (vedata=0x61700029ddb8, ob=0x61b0003185b8) at
#6 0x00005555783083b8 in drw_engines_cache_populate (ob=0x61b0003185b8) at
GDB Notes
In the usual case, most of these pointers are populated - in particular, the ##edit_mesh_*_grp## always seem pre-populated. Two frames up at ##3## in overlay_edit_mesh_add_ob_to_pass() ##pd->edit_mesh_edges_grp- [x]## is set to ##edge_shgrp## and is passed to ##DRW_shgroup_call_no_cull(edge_shgrp, geom_edges, ob)##, leading directly to the observed segment violation.
[Edit: omission]
Also at frame ##5## in OVERLAY_cache_populate() sets the ##in_edit_mode## flag to ##TRUE##, suggesting that the object being passed in, ##"OBMutt"## is itself still in edit mode.
As noted above, this behavior was not present in 2.81, but appears in builds after the Refactor & Cleanup commit. Stopped to do this report. Evening is still young here; plan to poke around some more.
system-info.txt
system info for stack trace
Added subscriber: @grosgood
Added subscribers: @dfelinto, @fclem
Yet to go over the steps to reproduce. But adding the interested parties as subscribed meanwhile.
Debug notes. I won't revisit this until after the 25th, and, with a head full of grog, will need notes to recover context.
Here is how ##OVERLAY_PrivateData *pd = data->stl->pd## in OVERLAY_cache_populate() winds up 'exhibiting interesting characteristics', as illustrated in the previous comment. It seems that ##OVERLAY_cache_populate()## is unaware of various drawing mode contexts within which callers operate, and how callers can set up ##OVERLAY_PrivateData *pd## in different ways. That's the bug in a nutshell. Gory details follow.
On the mouse click over "Mutt" ##OVERLAY_cache_populate()## executes:
##OVERLAY_cache_populate()##, depends on a prior invocation of OVERLAY_edit_mesh_cache_init() , which, among other things, populates the block of ##DRWShadingGroup## references in ##OVERLAY_PrivateData pd = data->stl->pd## (the ##edit_mesh__grp## and friends), and this prior invocation*almost always// takes place -- but not here, where Exclude from View Layer has been toggled.
##OVERLAY_edit_mesh_cache_init()##, upon which ##OVERLAY_cache_populate()## depends, is called upstream at [drw_engines_cache_init() ]], which iterates over a list of 'engine' objects of ##DrawEngineType##; the variable ##engine## at line #1099 successively assumes references to all active engines during the course of iteration, including the overlay engine, defined at https:*developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/overlay/overlay_engine.c$466. The member ##cache_init## contains a reference to an engine-specific cache initializer. ##engine## eventually assumes a reference to the overlay engine and its ##cache_init## member points to the overlay implementation [ https://developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/overlay/overlay_engine.c$99|OVERLAY_cache_init(void *vedata) . This function conditionally calls ##OVERLAY_edit_mesh_cache_init()## predicated on the draw mode state ##pd->ctx_mode == CTX_MODE_EDIT_MESH##.
However, with the click on "Mutt", the viewport is not in edit mode; it is in object mode, a condition arising from toggling Exclude from View Layer. See the screen shots in the previous comment. The draw mode ##pd->ctx_mode == CTX_MODE_OBJECT## prevails instead so ##OVERLAY_edit_mesh_cache_init()## does not execute and leaves ##OVERLAY_PrivateData *pd## in ##OVERLAY_cache_populate()## without the block of ##DRWShadingGroup## references set up. Having established that ##Mutt## is to be drawn as an object, ##OVERLAY_cache_init()## completes the rest of the initialization of what will be ##OVERLAY_PrivateData pd## in ##OVERLAY_cache_populate()## and returns to ##drw_engines_cache_init()##, which, in due course, returns to its caller ##DRW_draw_select_loop().##
With cache initialization complete, ##DRW_draw_select_loop()## invokes [drw_engines_cache_populate(Object *ob) ]] , which performs a similar iteration over engine objects seen in ##drw_engines_cache_init()##, but invoking the engines' ##engine->cache_populate(data, ob)## implementations instead. For the 'Overlay' engine, that implementation is [ https:*developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/overlay/overlay_engine.c$180|OVERLAY_cache_populate(void *vedata, Object *ob) , which extracts private data ##OVERLAY_PrivateData *pd## from parameter ##ViewportEngineData vedata## (recast in the function call to ##OVERLAY_data##). As noted, ##pd## lacks the benefit of ##OVERLAY_edit_mesh_cache_init()##, as ##OVERLAY_cache_init()## calls that function only in a draw mode of ##CTX_MODE_EDIT_MESH##, not the currently prevailing one: ##CTX_MODE_OBJECT##. Put another way, ##OVERLAY_cache_populate()## lives in draw mode context ##CTX_MODE_EDIT_MESH##, in that it assumes its prerequisite, ##OVERLAY_edit_mesh_cache_init(),## always runs, but, alas, it missed the memo announcing it must also populate in ##CTX_MODE_OBJECT## too. Having missed the memo, it proceeds as if ##DRWShadingGroup## references live in ##pd## when they do not. To sustain the illusion, ## BKE_object_is_in_editmode(ob)## returns true, assigning that to ##in_edit_mode## and setting the stage for calling ##OVERLAY_edit_mesh_cache_populate(vedata, ob)## and that, in turn, calling ##DRW_shgroup_call_ex (shgroup=0x0, ob=0x61b0003185b8, obmat=0x0, geom=0x6110007d8138, bypass_culling=true, user_data=0x0)## with a null ##shgroup## pointer.
This issue was referenced by
e2724abc22
Changed status from 'Needs Triage' to: 'Resolved'
@grosgood Thanks a lot for all the detailed informations and even then patch! I've commited an equivalent patch which is just a change of codestyle. The bug was caused by a false assumption so I think it's safe to treat is as solved. I just hope no other areas of blender make the same assumption.