Fix #105855: Crash with node add menu assets and keyboard navigation #106237

Closed
Julian Eisel wants to merge 1 commits from JulianEisel:temp-fix-105855-geo-node-add-menu-crash into blender-v3.5-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

The UI needs persistent pointers to catalog paths that it can pass
around via context. It was trying to manage this in own storage, but
this didn't work. Not entirely sure why - the menus get redrawn
continuously while assets load, and the root menu rebuilds the mentioned
storage every time. Maybe the submenus redraw a bit later, or the
keyboard navigation handling still accessed data from a previous redraw
somehow.

Either way, instead of managing own catalog path storage, point into the
asset system, which already has persistent storage for the catalog
paths.

The UI needs persistent pointers to catalog paths that it can pass around via context. It was trying to manage this in own storage, but this didn't work. Not entirely sure why - the menus get redrawn continuously while assets load, and the root menu rebuilds the mentioned storage every time. Maybe the submenus redraw a bit later, or the keyboard navigation handling still accessed data from a previous redraw somehow. Either way, instead of managing own catalog path storage, point into the asset system, which already has persistent storage for the catalog paths.
Julian Eisel added this to the 3.5 milestone 2023-03-28 19:00:00 +02:00
Julian Eisel added the
Module
Nodes & Physics
label 2023-03-28 19:00:00 +02:00
Hans Goudey was assigned by Julian Eisel 2023-03-28 19:00:00 +02:00
Julian Eisel added 1 commit 2023-03-28 19:00:12 +02:00
3f0b5b361d Fix 105855: Crash with node add menu assets and keyboard navigation
The UI needs persistent pointers to catalog paths that it can pass
around via context. It was trying to manage this in own storage, but
this didn't work. Not entirely sure why - the menus get redrawn
continuously while assets load, and the root menu rebuilds the mentioned
storage every time. Maybe the submenus redraw a bit later, or the
keyboard navigation handling still accessed data from a previous redraw
somehow.

Either way, instead of managing own catalog path storage, point into the
asset system, which already has persistent storage for the catalog
paths.
Hans Goudey was unassigned by Julian Eisel 2023-03-28 19:07:50 +02:00
Julian Eisel changed title from Fix 105855: Crash with node add menu assets and keyboard navigation to WIP: Fix 105855: Crash with node add menu assets and keyboard navigation 2023-03-28 19:07:55 +02:00
Julian Eisel changed title from WIP: Fix 105855: Crash with node add menu assets and keyboard navigation to Fix 105855: Crash with node add menu assets and keyboard navigation 2023-03-28 19:08:01 +02:00
Julian Eisel requested review from Hans Goudey 2023-03-28 19:08:13 +02:00
Author
Member

I might not be around to push this myself today, and I know there will be release -> main merge conflicts after this. In this case, apply the changes from the release branch and this patch:

diff --git a/source/blender/editors/space_node/add_menu_assets.cc b/source/blender/editors/space_node/add_menu_assets.cc
index 1aa8762bed4..bf44b2404b1 100644
--- a/source/blender/editors/space_node/add_menu_assets.cc
+++ b/source/blender/editors/space_node/add_menu_assets.cc
@@ -222,7 +222,8 @@ static void node_add_catalog_assets_draw(const bContext *C, Menu *menu)
 
     uiLayout *col = uiLayoutColumn(layout, false);
     uiLayoutSetContextPointer(col, "asset_catalog_path", &path_ptr);
-    uiItemM(col, "NODE_MT_node_add_catalog_assets", child_item.get_name().c_str(), ICON_NONE);
+    uiItemM(
+        col, "NODE_MT_node_add_catalog_assets", IFACE_(child_item.get_name().c_str()), ICON_NONE);
   });
 }
 
@@ -298,7 +299,7 @@ static void add_root_catalogs_draw(const bContext *C, Menu *menu)
     }
     uiLayout *col = uiLayoutColumn(layout, false);
     uiLayoutSetContextPointer(col, "asset_catalog_path", &path_ptr);
-    uiItemM(col, "NODE_MT_node_add_catalog_assets", item.get_name().c_str(), ICON_NONE);
+    uiItemM(col, "NODE_MT_node_add_catalog_assets", IFACE_(item.get_name().c_str()), ICON_NONE);
   });
 }
 

I might not be around to push this myself today, and I know there will be release -> `main` merge conflicts after this. In this case, apply the changes from the release branch and this patch: ```diff diff --git a/source/blender/editors/space_node/add_menu_assets.cc b/source/blender/editors/space_node/add_menu_assets.cc index 1aa8762bed4..bf44b2404b1 100644 --- a/source/blender/editors/space_node/add_menu_assets.cc +++ b/source/blender/editors/space_node/add_menu_assets.cc @@ -222,7 +222,8 @@ static void node_add_catalog_assets_draw(const bContext *C, Menu *menu) uiLayout *col = uiLayoutColumn(layout, false); uiLayoutSetContextPointer(col, "asset_catalog_path", &path_ptr); - uiItemM(col, "NODE_MT_node_add_catalog_assets", child_item.get_name().c_str(), ICON_NONE); + uiItemM( + col, "NODE_MT_node_add_catalog_assets", IFACE_(child_item.get_name().c_str()), ICON_NONE); }); } @@ -298,7 +299,7 @@ static void add_root_catalogs_draw(const bContext *C, Menu *menu) } uiLayout *col = uiLayoutColumn(layout, false); uiLayoutSetContextPointer(col, "asset_catalog_path", &path_ptr); - uiItemM(col, "NODE_MT_node_add_catalog_assets", item.get_name().c_str(), ICON_NONE); + uiItemM(col, "NODE_MT_node_add_catalog_assets", IFACE_(item.get_name().c_str()), ICON_NONE); }); } ```
Julian Eisel changed title from Fix 105855: Crash with node add menu assets and keyboard navigation to Fix #105855: Crash with node add menu assets and keyboard navigation 2023-03-28 19:35:45 +02:00
Hans Goudey approved these changes 2023-03-29 04:39:50 +02:00
Hans Goudey left a comment
Member

It's too bad we don't know exactly why the storage isn't persistent enough, but I'm not too surprised honestly, and I don't have a guess of my own. The new code makes sense anyway.

It's too bad we don't know exactly why the storage isn't persistent enough, but I'm not too surprised honestly, and I don't have a guess of my own. The new code makes sense anyway.
@ -74,0 +77,4 @@
/**
* The menus want to pass catalog paths to context and for this they need persistent pointers to
* the paths. Rather than keeping some own path storage, get a pointer into the asset system
Member

"own" in some own path storage doesn't quite make sense grammatically, I replaced it with "local".

"own" in `some own path storage` doesn't quite make sense grammatically, I replaced it with "local".
HooglyBoogly marked this conversation as resolved
@ -74,0 +85,4 @@
const asset_system::AssetLibrary &library,
const asset_system::AssetCatalogTreeItem &item)
{
asset_system::AssetCatalog *catalog = library.catalog_service->find_catalog_by_path(
Member

I made this pointer const, and the one below, since there's already a const cast below, and keeping the non-const local to RNA makes most sense.

I made this pointer const, and the one below, since there's already a const cast below, and keeping the non-const local to RNA makes most sense.
HooglyBoogly marked this conversation as resolved
Hans Goudey closed this pull request 2023-03-29 04:49:59 +02:00
Julian Eisel deleted branch temp-fix-105855-geo-node-add-menu-crash 2023-03-29 12:37:21 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
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
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#106237
No description provided.