Blender crashes when dragging Material-Assets into the 3D Viewport #92501

Closed
opened 2021-10-26 15:24:06 +02:00 by Marcel Freyer · 15 comments

System Information
Operating system: Windows-10-10.0.19043-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 496.13

Blender Version
Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-10-25 23:16, hash: 32cc9ff037
Worked: version: 3.0.0 Alpha, branch: master, commit date: 2021-10-23 20:02, hash: 8c21667f3c
Caused by e8027ec2a0

Short description of error

Blender will crash instantly, as soon as I drag the material asset from the asset browser over the boundry of the 3D viewport.
The crash happens exactly when the dragged material icon preview reaches the border to the 3d viewport, but not other editors / panels. If i drag it over other editors, blender doesn't crash.

Exact steps for others to reproduce the error

  • Open the asset browser on the left side of the 3d viewport;
  • Grab a material-asset from the asset browser and try to drag it to the right into the 3d viewport;
  • Blender will crash instantly wenn crossing the dividing line between the two panels.

Point of Crash.png

Point of Crash marked.png

2021-10-26 15_21_46-Blender.png

Material Asset dragging crash - Marcel Freyer.blend

**System Information** Operating system: Windows-10-10.0.19043-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 496.13 **Blender Version** Broken: version: 3.0.0 Alpha, branch: master, commit date: 2021-10-25 23:16, hash: `32cc9ff037` Worked: version: 3.0.0 Alpha, branch: master, commit date: 2021-10-23 20:02, hash: `8c21667f3c` Caused by e8027ec2a0 **Short description of error** Blender will crash instantly, as soon as I drag the material asset from the asset browser over the boundry of the 3D viewport. The crash happens exactly when the dragged material icon preview reaches the border to the 3d viewport, but not other editors / panels. If i drag it over other editors, blender doesn't crash. **Exact steps for others to reproduce the error** - Open the asset browser on the left side of the 3d viewport; - Grab a material-asset from the asset browser and try to drag it to the right into the 3d viewport; - Blender will crash instantly wenn crossing the dividing line between the two panels. ![Point of Crash.png](https://archive.blender.org/developer/F11523381/Point_of_Crash.png) ![Point of Crash marked.png](https://archive.blender.org/developer/F11523453/Point_of_Crash_marked.png) ![2021-10-26 15_21_46-Blender.png](https://archive.blender.org/developer/F11523497/2021-10-26_15_21_46-Blender.png) [Material Asset dragging crash - Marcel Freyer.blend](https://archive.blender.org/developer/F11523353/Material_Asset_dragging_crash_-_Marcel_Freyer.blend)
Author

Added subscriber: @WorldBuilder

Added subscriber: @WorldBuilder

#92690 was marked as duplicate of this issue

#92690 was marked as duplicate of this issue
Member

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

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

Added subscriber: @Baardaap

Added subscriber: @Baardaap

I bisected it to commit e8027ec2a0

UI Drag Drop: allow customizable drawing

I bisected it to commit e8027ec2a0cac4b0e92d51a64ccc40fd3f190a20 UI Drag Drop: allow customizable drawing

I don't have any time to look into it further (and I don't know anything about this code) I just bisected it because I had my bisecting setup ready to go.

I don't have any time to look into it further (and I don't know anything about this code) I just bisected it because I had my bisecting setup ready to go.
Member

Added subscribers: @Alumx, @PratikPB2123, @deadpin

Added subscribers: @Alumx, @PratikPB2123, @deadpin

Added subscriber: @dfelinto

Added subscriber: @dfelinto
Germano Cavalcante was assigned by Dalai Felinto 2021-11-02 17:37:05 +01:00

Hi Germano, can you look at this? The issue was added in your commit.

Hi Germano, can you look at this? The issue was added in your commit.
Member

Added subscribers: @mano-wii, @JulianEisel

Added subscribers: @mano-wii, @JulianEisel
Germano Cavalcante was unassigned by Julian Eisel 2021-11-02 18:44:56 +01:00
Julian Eisel self-assigned this 2021-11-02 18:44:56 +01:00
Member

What happens is that the tooltip text is now received while drawing the drag feedback. But there is a mismatch between the context we use for this, and the context we use for polling if the drop-box and operator are available. So the polling may succeed, and then the tooltip callback executes logic with the rightful assumption that a poll was done in the current context, with context that doesn't actually match the polling.

Fixing the bug itself isn't that difficult. We could go back to generating the tooltip text from where we also execute the polling. Or we store the area & region from context during polling and restore that when drawing. However, we also have a custom draw-callback now, that may assume (also rightfully I think) a context matching the poll context. So I think we should properly restore context.
I'd propose this:

  • Store the area and region the dropbox and its operator were polled in, similar to wmTooltipState. Restore that context for drawing.
  • Optionally: Move either the tooltip or the disabled-hint generation to the same place. Currently the disabled hint is set when polling/activating, tooltips are generated when drawing. To move the disabled hint to the drawing would mean executing the operator poll again, like the regular button tooltip code does it.
  • Either remove wmDropBox.opcontext or ensure it's used to override context when drawing. Checked with Campbell, we seem to agree to remove it. Dropboxes are supposed to check and operate on the context under the mouse cursor anyway.

I have a patch for this, just needs some more cleanup.

What happens is that the tooltip text is now received while drawing the drag feedback. But there is a mismatch between the context we use for this, and the context we use for polling if the drop-box and operator are available. So the polling may succeed, and then the tooltip callback executes logic with the rightful assumption that a poll was done in the current context, with context that doesn't actually match the polling. Fixing the bug itself isn't that difficult. We could go back to generating the tooltip text from where we also execute the polling. Or we store the area & region from context during polling and restore that when drawing. However, we also have a custom draw-callback now, that may assume (also rightfully I think) a context matching the poll context. So I think we should properly restore context. I'd propose this: * Store the area and region the dropbox and its operator were polled in, similar to `wmTooltipState`. Restore that context for drawing. * Optionally: Move either the tooltip or the disabled-hint generation to the same place. Currently the disabled hint is set when polling/activating, tooltips are generated when drawing. To move the disabled hint to the drawing would mean executing the operator poll again, like the regular button tooltip code does it. * Either remove `wmDropBox.opcontext` or ensure it's used to override context when drawing. Checked with Campbell, we seem to agree to remove it. Dropboxes are supposed to check and operate on the context under the mouse cursor anyway. I have a patch for this, just needs some more cleanup.

On the points mentioned, I am tempted to the first point. This area and region could be used for both the tooltip and the operator.
Another point that could be added would be, - look for the correct region in the tooltip callback itself. If I'm not mistaken, only 2 callbacks require the region.
This was the direction chosen for D13076.

On the points mentioned, I am tempted to the first point. This area and region could be used for both the tooltip and the operator. Another point that could be added would be, `- look for the correct region in the tooltip callback itself`. If I'm not mistaken, only 2 callbacks require the region. This was the direction chosen for [D13076](https://archive.blender.org/developer/D13076).
Member

I don't think we should do workarounds like looking up the region from the operator. The drag/drop system should ensure the correct context. The design of operators is to have them act on context.

I didn't mean my list to represent alternatives, but 3 things we should do together I think. While the first point is enough to fix this issue, it is not enough to ensure the same context for the drawing that used for the polling and operator execution.
P2570 does these things, without removing wmDropBox.opcontext, but using the operator context properly.


So, for the 3.0 branch I'd suggest just this to fix the crash:

Store the area and region the dropbox and its operator were polled in, similar to wmTooltipState. Restore that context for drawing.

Then in master, we can do the following in addition:

  • Move either the tooltip or the disabled-hint generation so both are in the same place.
  • Remove wmDropBox.opcontext (i.e. always invoke/execute in area & region context stored from the polling).
I don't think we should do workarounds like looking up the region from the operator. The drag/drop system should ensure the correct context. The design of operators is to have them act on context. I didn't mean my list to represent alternatives, but 3 things we should do together I think. While the first point is enough to fix this issue, it is not enough to ensure the same context for the drawing that used for the polling and operator execution. [P2570](https://archive.blender.org/developer/P2570.txt) does these things, without removing `wmDropBox.opcontext`, but using the operator context properly. ---- So, for the 3.0 branch I'd suggest just this to fix the crash: > Store the area and region the dropbox and its operator were polled in, similar to wmTooltipState. Restore that context for drawing. Then in master, we can do the following in addition: * Move either the tooltip or the disabled-hint generation so both are in the same place. * Remove `wmDropBox.opcontext` (i.e. always invoke/execute in area & region context stored from the polling).

This issue was referenced by 80a46955d8

This issue was referenced by 80a46955d8212f01b77215ab12d479d934e305f4
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Thomas Dinges added this to the 3.0 milestone 2023-02-08 15:58:48 +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
7 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#92501
No description provided.