Cleanup: always run both RNA_STRUCT_BEGIN & END macros

In this case it didn't cause any problems however macros with a
BEGIN/END must always run both, not optionally run based on knowledge
of the iterator implementation cleanup requirement.
This commit is contained in:
Campbell Barton
2023-09-14 10:21:22 +10:00
parent 6fcdcd4108
commit fad72f6daa
3 changed files with 14 additions and 5 deletions

View File

@@ -440,14 +440,16 @@ static void run_node_group_ui(bContext *C, wmOperator *op)
static bool run_node_ui_poll(wmOperatorType * /*ot*/, PointerRNA *ptr)
{
bool result = false;
RNA_STRUCT_BEGIN (ptr, prop) {
int flag = RNA_property_flag(prop);
if ((flag & PROP_HIDDEN) == 0) {
return true;
result = true;
break;
}
}
RNA_STRUCT_END;
return false;
return result;
}
static std::string run_node_group_get_name(wmOperatorType * /*ot*/, PointerRNA *ptr)

View File

@@ -2876,6 +2876,7 @@ static bool ui_layout_operator_properties_only_booleans(const bContext *C,
PointerRNA ptr = RNA_pointer_create(&wm->id, op->type->srna, op->properties);
bool all_booleans = true;
RNA_STRUCT_BEGIN (&ptr, prop) {
if (RNA_property_flag(prop) & PROP_HIDDEN) {
continue;
@@ -2885,10 +2886,14 @@ static bool ui_layout_operator_properties_only_booleans(const bContext *C,
continue;
}
if (RNA_property_type(prop) != PROP_BOOLEAN) {
return false;
all_booleans = false;
break;
}
}
RNA_STRUCT_END;
if (all_booleans == false) {
return false;
}
}
return true;

View File

@@ -1025,16 +1025,18 @@ bool WM_operator_ui_poll(wmOperatorType *ot, PointerRNA *ptr)
return true;
}
bool result = false;
PointerRNA op_ptr;
WM_operator_properties_create_ptr(&op_ptr, ot);
RNA_STRUCT_BEGIN (&op_ptr, prop) {
int flag = RNA_property_flag(prop);
if ((flag & PROP_HIDDEN) == 0) {
return true;
result = true;
break;
}
}
RNA_STRUCT_END;
return false;
return result;
}
void WM_operator_region_active_win_set(bContext *C)