[Bf-blender-cvs] [3b66d2ed21a] blender-v2.81-release: Fix T71405: Trying to Ctrl-C on many buttons crashes Blender

Philipp Oeser noreply at git.blender.org
Fri Nov 8 14:38:00 CET 2019


Commit: 3b66d2ed21a35036f8221d831f96556f85261db9
Author: Philipp Oeser
Date:   Thu Nov 7 17:53:05 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rB3b66d2ed21a35036f8221d831f96556f85261db9

Fix T71405: Trying to Ctrl-C on many buttons crashes Blender

Usually Ctrl+C copies the operator name to the clipboard
["bpy.ops.material.new()", "bpy.ops.object.material_slot_remove()"]
Crash happens for all buttons of UI_BTYPE_BUT without associated
operator [some are defined with callbacks only, often these are created
with e.g uiDefIconBut (instead of e.g. uiDefIconButO)]

Other examples that crash with Ctrl+C:
- animation decorators next to animatable properties
- button to show a modifier texture in the texture tab
- ...

2.79 survived here (result in the clipboard was just not changed hitting
Ctrl+C on these buttons), this is what happens with this patch as well.

Maniphest Tasks: T71405

Differential Revision: https://developer.blender.org/D6208

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

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

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

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 2d739899ae8..0b4adb33b1c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2528,6 +2528,9 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
       break;
 
     case UI_BTYPE_BUT:
+      if (!but->optype) {
+        break;
+      }
       ui_but_copy_operator(C, but, buf, buf_max_len);
       is_buf_set = true;
       break;



More information about the Bf-blender-cvs mailing list