Fix #119778: Crash in popovers that do not support refreshing #119796

Merged
Jacques Lucke merged 1 commits from guishe/blender:fix-popover-crash into main 2024-03-22 17:09:12 +01:00
Contributor

When creating popover with UI_popover_begin the popover block
is created just once without a region and since UI_popover_begin blocks
are not support refreshing, layout panels may not be compatible
in this kind of popover since open/close state cannot be refreshed either.

Only UILayout.popover(...) popovers are supported to have layout panels.

When creating popover with `UI_popover_begin` the popover block is created just once without a region and since `UI_popover_begin` blocks are not support refreshing, layout panels may not be compatible in this kind of popover since open/close state cannot be refreshed either. Only `UILayout.popover(...)` popovers are supported to have layout panels.
Guillermo Venegas added 1 commit 2024-03-22 16:51:18 +01:00
Iliya Katushenock added this to the User Interface project 2024-03-22 17:01:59 +01:00
Iliya Katushenock requested review from Jacques Lucke 2024-03-22 17:02:07 +01:00
Author
Contributor

this can also fix the issue to avoid non refreshing popovers to setting the dummy panel

diff --git a/source/blender/editors/interface/interface_layout.cc b/source/blender/editors/interface/interface_layout.cc
index 0e80e153235..34f8f96160e 100644
--- a/source/blender/editors/interface/interface_layout.cc
+++ b/source/blender/editors/interface/interface_layout.cc
@@ -2968,6 +2968,8 @@ void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt)
 void ui_item_paneltype_func(bContext *C, uiLayout *layout, void *arg_pt)
 {
   PanelType *pt = (PanelType *)arg_pt;
+  uiBlock *block = uiLayoutGetBlock(layout);
+  UI_popup_dummy_panel_set(block->handle->region, block);
   UI_paneltype_draw(C, pt, layout);
 }

@@ -6144,12 +6146,6 @@ static void ui_paneltype_draw_impl(bContext *C, PanelType *pt, uiLayout *layout,
     ui_block_add_dynamic_listener(block, pt->listener);
   }

-  /* This check may be paranoid, this function might run outside the context of a popup. */
-  if (block->handle) {
-    /* Allow popovers to contain collapsible sections, see #uiItemPopoverPanel. */
-    UI_popup_dummy_panel_set(block->handle->region, block);
-  }
-
   uiLayout *last_item = static_cast<uiLayout *>(layout->items.last);

this can also fix the issue to avoid non refreshing popovers to setting the dummy panel ```diff diff --git a/source/blender/editors/interface/interface_layout.cc b/source/blender/editors/interface/interface_layout.cc index 0e80e153235..34f8f96160e 100644 --- a/source/blender/editors/interface/interface_layout.cc +++ b/source/blender/editors/interface/interface_layout.cc @@ -2968,6 +2968,8 @@ void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) void ui_item_paneltype_func(bContext *C, uiLayout *layout, void *arg_pt) { PanelType *pt = (PanelType *)arg_pt; + uiBlock *block = uiLayoutGetBlock(layout); + UI_popup_dummy_panel_set(block->handle->region, block); UI_paneltype_draw(C, pt, layout); } @@ -6144,12 +6146,6 @@ static void ui_paneltype_draw_impl(bContext *C, PanelType *pt, uiLayout *layout, ui_block_add_dynamic_listener(block, pt->listener); } - /* This check may be paranoid, this function might run outside the context of a popup. */ - if (block->handle) { - /* Allow popovers to contain collapsible sections, see #uiItemPopoverPanel. */ - UI_popup_dummy_panel_set(block->handle->region, block); - } - uiLayout *last_item = static_cast<uiLayout *>(layout->items.last); ```
Jacques Lucke approved these changes 2024-03-22 17:06:30 +01:00
Dismissed
Jacques Lucke approved these changes 2024-03-22 17:06:40 +01:00
Author
Contributor

Support in popovers was added in: 02681bd44d

Support in popovers was added in: https://projects.blender.org/blender/blender/commit/02681bd44d285b51ffe9cf6d3df71af1980a6f70
Member

Will commit this fix first, because I'm a bit short on time. Feel free to create a separate PR for the extended functionality.

Will commit this fix first, because I'm a bit short on time. Feel free to create a separate PR for the extended functionality.
Jacques Lucke merged commit 7fabf0d896 into main 2024-03-22 17:09:12 +01:00
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#119796
No description provided.