[Bf-blender-cvs] [589a8104c34] blender-v3.2-release: Fix T98715: Crash drag-dropping collection from outliner to ID property

Julian Eisel noreply at git.blender.org
Wed Jun 22 13:02:59 CEST 2022


Commit: 589a8104c34b163ab03f8499440ea7f5d4f20193
Author: Julian Eisel
Date:   Tue Jun 14 11:53:38 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB589a8104c34b163ab03f8499440ea7f5d4f20193

Fix T98715: Crash drag-dropping collection from outliner to ID property

The value of disabled buttons shouldn't be changed through dropping onto
it. Check for the disabled state in the drop operator poll, so the
dragging code will change the cursor to show that dropping isn't
possible at the given cursor location.

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

M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_ops.c

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

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 3e3b30a2c1e..a07bedfe443 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2954,6 +2954,9 @@ void ui_but_text_password_hide(char password_str[UI_MAX_PASSWORD_STR],
 
 void ui_but_set_string_interactive(bContext *C, uiBut *but, const char *value)
 {
+  /* Caller should check. */
+  BLI_assert((but->flag & UI_BUT_DISABLED) == 0);
+
   button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
   ui_textedit_string_set(but, but->active, value);
 
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index f14c6ad9924..80ccf157b25 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -1940,6 +1940,24 @@ static void UI_OT_drop_color(wmOperatorType *ot)
 /** \name Drop Name Operator
  * \{ */
 
+static bool drop_name_poll(bContext *C)
+{
+  if (!ED_operator_regionactive(C)) {
+    return false;
+  }
+
+  const uiBut *but = UI_but_active_drop_name_button(C);
+  if (!but) {
+    return false;
+  }
+
+  if (but->flag & UI_BUT_DISABLED) {
+    return false;
+  }
+
+  return true;
+}
+
 static int drop_name_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 {
   uiBut *but = UI_but_active_drop_name_button(C);
@@ -1959,7 +1977,7 @@ static void UI_OT_drop_name(wmOperatorType *ot)
   ot->idname = "UI_OT_drop_name";
   ot->description = "Drop name to button";
 
-  ot->poll = ED_operator_regionactive;
+  ot->poll = drop_name_poll;
   ot->invoke = drop_name_invoke;
   ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;



More information about the Bf-blender-cvs mailing list