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
This commit is contained in:
parent
398de297cf
commit
3e3a70a8bb
Notes:
blender-bot
2023-04-26 22:29:48 +02:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93 Referenced by issue #88449, Blender LTS: Maintenance Task 2.93 Referenced by issue #102014, File Browser: Move Bookmark buttons malfunction if no item is selected Referenced by issue #107384, [Blender 2.93] When bpy.ops.file.bookmark_move.poll() is called outside of the File Browser, Blender crashes.
|
@ -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! */
|
||||
|
|
Loading…
Reference in New Issue