[Bf-blender-cvs] [3e3a70a8bb1] blender-v2.93-release: Fix File Browser Move Bookmark malfunction if no item is selected

Philipp Oeser noreply at git.blender.org
Wed Dec 14 14:42:42 CET 2022


Commit: 3e3a70a8bb178caaf1f5975d72c79a1cdcf23c68
Author: Philipp Oeser
Date:   Fri Nov 4 10:28:20 2022 +0100
Branches: blender-v2.93-release
https://developer.blender.org/rB3e3a70a8bb178caaf1f5975d72c79a1cdcf23c68

Fix File Browser Move Bookmark malfunction if no item is selected

The operator was acting on non selected items (wasnt checking SpaceFile
bookmarknr for being -1) which could end up removing items even.

Now sanatize this by introducing proper poll (which returns false if
nothing is selected).

Fixes T102014.

Maniphest Tasks: T102014

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

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

M	source/blender/editors/space_file/file_ops.c

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

diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 856bd5b1bc3..435f8cd274b 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1280,6 +1280,13 @@ static int bookmark_move_exec(bContext *C, wmOperator *op)
   return OPERATOR_FINISHED;
 }
 
+static bool file_bookmark_move_poll(bContext *C)
+{
+  SpaceFile *sfile = CTX_wm_space_file(C);
+
+  return sfile->bookmarknr != -1;
+}
+
 void FILE_OT_bookmark_move(wmOperatorType *ot)
 {
   static const EnumPropertyItem slot_move[] = {
@@ -1297,6 +1304,7 @@ void FILE_OT_bookmark_move(wmOperatorType *ot)
   /* api callbacks */
   ot->poll = ED_operator_file_active;
   ot->exec = bookmark_move_exec;
+  ot->poll = file_bookmark_move_poll;
 
   /* flags */
   ot->flag = OPTYPE_REGISTER; /* No undo! */



More information about the Bf-blender-cvs mailing list