[Bf-blender-cvs] [ad4928a1710] master: UI: avoid aligning labels for ui_item_with_label

Campbell Barton noreply at git.blender.org
Thu Jul 16 09:15:35 CEST 2020


Commit: ad4928a1710fe96749484b3823513d3f7c5624aa
Author: Campbell Barton
Date:   Thu Jul 16 17:00:16 2020 +1000
Branches: master
https://developer.blender.org/rBad4928a1710fe96749484b3823513d3f7c5624aa

UI: avoid aligning labels for ui_item_with_label

Key-map display was doing thousands of redundant alignment operations.
Set the spacing instead as align was only set to use zero spacing.

This would have prevented the crash reported by T78636.

===================================================================

M	source/blender/editors/interface/interface_layout.c

===================================================================

diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 858b48ba9fa..f027a62cbfd 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -947,8 +947,11 @@ static uiBut *ui_item_with_label(uiLayout *layout,
   const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0);
 #endif
 
-  /* Always align item with label since text is already given enough space not to overlap. */
-  sub = uiLayoutRow(layout, true);
+  /* Previously 'align' was enabled to make sure the label is spaced closely to the button.
+   * Set the space to zero instead as aligning a large number of labels can end up aligning
+   * thousands of buttons when displaying key-map search (a heavy operation), see: T78636. */
+  sub = uiLayoutRow(layout, false);
+  sub->space = 0;
   UI_block_layout_set_current(block, sub);
 
 #ifdef UI_PROP_DECORATE



More information about the Bf-blender-cvs mailing list