Fix #122423: Clear Handlers for Non-Temporary Regions on Exit #122922

Manually merged
Campbell Barton merged 1 commits from Harley/blender:Fix122423b into blender-v4.2-release 2024-06-19 01:58:07 +02:00
Member

On Region exit ensure that operator handler pointers to it are set to
nullptr. Currently this is happening only for temporary region UI
handlers.


Testing must be in debug mode.

When joining screen areas, one area and its regions will be removed. With the changes in b25eefbf9a the closed regions will not have operator handler pointers cleared. wm_gizmomaps_handled_modal_update tries to detect this situation (has a comment of "Happens on render or when joining areas") by checking if the handler's region is null and will early return. Unfortunately this test passes because the region pointer is not cleared, pointing at deallocated ram. Then it dies trying to get that region's gizmo map.

The referenced commit replaced the region handler clearing with a new one that is only run for RGN_TYPE_TEMPORARY regions. This PR puts back the old call to WM_event_modal_handler_region_replace afterward. This fixes the errors when joining areas and does not seem to affect anything shown in #122132, but I am not running ASAN. This also seems related to #120612 and wasn't sure how to test that.

On Region exit ensure that operator handler pointers to it are set to nullptr. Currently this is happening only for temporary region UI handlers. --- Testing must be in debug mode. When joining screen areas, one area and its regions will be removed. With the changes in b25eefbf9acb51df61bb264686d9da42d2499e18 the closed regions will not have operator handler pointers cleared. `wm_gizmomaps_handled_modal_update` tries to detect this situation (has a comment of "Happens on render or when joining areas") by checking if the handler's region is null and will early return. Unfortunately this test passes because the region pointer is not cleared, pointing at deallocated ram. Then it dies trying to get that region's gizmo map. The referenced commit replaced the region handler clearing with a new one that is only run for RGN_TYPE_TEMPORARY regions. This PR puts back the old call to `WM_event_modal_handler_region_replace` afterward. This fixes the errors when joining areas and does not seem to affect anything shown in #122132, but I am not running ASAN. This also seems related to #120612 and wasn't sure how to test that.
Harley Acheson added this to the User Interface project 2024-06-08 17:28:14 +02:00
Harley Acheson requested review from Campbell Barton 2024-06-08 17:28:22 +02:00
Harley Acheson force-pushed Fix122423b from 5707074bdc to aa77a28fa6 2024-06-08 17:39:34 +02:00 Compare
Harley Acheson changed target branch from main to blender-v4.2-release 2024-06-08 17:40:05 +02:00
Harley Acheson added this to the 4.3 milestone 2024-06-08 17:48:23 +02:00
Harley Acheson modified the milestone from 4.3 to 4.2 LTS 2024-06-08 17:48:34 +02:00
Harley Acheson changed title from Fix #122423 - Clear Handlers for Non-Temporary Regions on Exit to Fix #122423: Clear Handlers for Non-Temporary Regions on Exit 2024-06-08 22:47:35 +02:00
Harley Acheson force-pushed Fix122423b from aa77a28fa6 to 62277f00c7 2024-06-18 19:54:19 +02:00 Compare
Campbell Barton approved these changes 2024-06-19 01:50:09 +02:00
Campbell Barton manually merged commit ad625d8dc4 into blender-v4.2-release 2024-06-19 01:58:07 +02:00
Harley Acheson deleted branch Fix122423b 2024-06-19 03:34:41 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
2 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#122922
No description provided.