From 3b66d2ed21a35036f8221d831f96556f85261db9 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 7 Nov 2019 17:53:05 +0100 Subject: 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 --- source/blender/editors/interface/interface_handlers.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender') 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; -- cgit v1.2.3