Fix #54468: crash calling transform operators with incomplete regiondata #119205

Merged
Philipp Oeser merged 2 commits from lichtwerk/blender:54468 into blender-v4.1-release 2024-03-11 09:27:42 +01:00
Member

If we run into NULL RegionView3D regiondata [which e.g. happens if
we just set bpy.context.area.type = 'VIEW_3D' without further actions
in the text editor prior to calling the transform operator], we can make
it gracefully work just by using t->spacetype = SPACE_EMPTY in
initTransInfo.

Similar check is already done in ba229e3859 (marked /* running in the
text editor */).

Transform code is smart enough to have fallback code in place that sets
matrices etc.

If we run into NULL `RegionView3D` `regiondata` [which e.g. happens if we just set `bpy.context.area.type = 'VIEW_3D'` without further actions in the text editor prior to calling the transform operator], we can make it gracefully work just by using `t->spacetype = SPACE_EMPTY` in `initTransInfo`. Similar check is already done in ba229e38597c (marked /* running in the text editor */). Transform code is smart enough to have fallback code in place that sets matrices etc.
Philipp Oeser added 1 commit 2024-03-08 13:49:28 +01:00
b67ebea8ec Fix #54468: crash calling transform operators with incomplete regiondata
If we run into NULL `RegionView3D` `regiondata` [which e.g. happens if
we just set `bpy.context.area.type = 'VIEW_3D'` without further actions
in the text editor prior to calling the transform operator], we can make
it gracefully work just by using `t->spacetype = SPACE_EMPTY` in
`initTransInfo`.

Similar check is already done in ba229e3859 (marked /* running in the
text editor */).

Transform code is smart enough to have fallback code in place that sets
matrices etc.
Philipp Oeser added this to the Python API project 2024-03-08 13:49:52 +01:00
Philipp Oeser added the
Interest
Modeling
label 2024-03-08 13:50:00 +01:00
Philipp Oeser requested review from Campbell Barton 2024-03-08 13:50:09 +01:00
Philipp Oeser requested review from Germano Cavalcante 2024-03-08 13:50:19 +01:00
Author
Member

Note : there are probably other operators (not just transform) that have the same problem, havent checked those though (for those, it might mke sense to be more strict in a poll -- but since transform code can handle this gracefully, this PR only handles that for now)

Note : there are probably other operators (not just transform) that have the same problem, havent checked those though (for those, it might mke sense to be more strict in a poll -- but since transform code can handle this gracefully, this PR only handles that for now)
Germano Cavalcante approved these changes 2024-03-08 14:24:07 +01:00
@ -243,1 +242,4 @@
else if (((region == nullptr) || (region->regiondata == nullptr)) &&
(area->spacetype == SPACE_VIEW3D))
{
/* running in the text editor */

I think we could take advantage and improve the comment here to something like:

/* Running the operator through the text editor where `area.type` was set to 'VIEW_3D' but the viewport was not updated. */

I wonder how the previous condition was triggered... When the region is nullptr? Maybe it's worth including in the comment too.

And, just to make it clearer that the problem is when setting VIEW_3D, it may be interesting to put (area->spacetype == SPACE_VIEW3D) before.

In any case, LGTM.

I think we could take advantage and improve the comment here to something like: ``` /* Running the operator through the text editor where `area.type` was set to 'VIEW_3D' but the viewport was not updated. */ ``` I wonder how the previous condition was triggered... When the region is nullptr? Maybe it's worth including in the comment too. And, just to make it clearer that the problem is when setting `VIEW_3D`, it may be interesting to put `(area->spacetype == SPACE_VIEW3D)` before. In any case, LGTM.
Campbell Barton approved these changes 2024-03-11 05:17:28 +01:00
Philipp Oeser added 1 commit 2024-03-11 09:13:11 +01:00
Philipp Oeser merged commit a8b9a58608 into blender-v4.1-release 2024-03-11 09:27:42 +01:00
Philipp Oeser deleted branch 54468 2024-03-11 09:27:47 +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#119205
No description provided.