From 2eda5e5d3c52eb2931276fec8f2b41e209a27794 Mon Sep 17 00:00:00 2001
From: Philipp Oeser <philipp@blender.org>
Date: Thu, 6 Jun 2024 11:09:35 +0200
Subject: [PATCH] Fix #122526: Pie menu executes the active as well as the
 shortcut button

A bit on shaky ground here, but it looks like we actually dont want to
execute the hovered buttons value/op if we chose another item in the pie
menu. This can be achieved by using the **onfree** arg to
`button_activate_exit` called on the active(hovered) button.

Not sure if this is the correct solution tbh (but maybe it demonstrates
where the bug of #122526 can be located).
I have tested pie menus with this patch and they seems to behave
normally (even nested ones).

Pull Request: https://projects.blender.org/blender/blender/pulls/122567

Pull Request: https://projects.blender.org/blender/blender/pulls/123002
---
 source/blender/editors/interface/interface_handlers.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index c0f3af6b4f4..736480b983e 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -10904,7 +10904,8 @@ static int ui_but_pie_button_activate(bContext *C, uiBut *but, uiPopupBlockHandl
   uiBut *active_but = ui_region_find_active_but(menu->region);
 
   if (active_but) {
-    button_activate_exit(C, active_but, active_but->active, false, false);
+    /* Use onfree to not execute the hovered active_but. */
+    button_activate_exit(C, active_but, active_but->active, false, true);
   }
 
   button_activate_init(C, menu->region, but, BUTTON_ACTIVATE_OVER);
-- 
GitLab