UI: enable string properties for alt-click buttons for multiple objects #106599

Merged
Philipp Oeser merged 2 commits from lichtwerk/blender:106591 into main 2023-04-11 10:28:03 +02:00
1 changed files with 5 additions and 2 deletions
Showing only changes of commit 1a3d4c5467 - Show all commits

View File

@ -1918,7 +1918,7 @@ static void ui_selectcontext_apply(bContext *C,
bool b;
int i;
float f;
char str[MAX_NAME];
char *str;
PointerRNA p;
} delta, min, max;
@ -1953,7 +1953,7 @@ static void ui_selectcontext_apply(bContext *C,
}
else if (rna_type == PROP_STRING) {
/* Not a delta in fact. */
RNA_property_string_get(&but->rnapoin, prop, delta.str);
delta.str = RNA_property_string_get_alloc(&but->rnapoin, prop, nullptr, 0, nullptr);
lichtwerk marked this conversation as resolved Outdated

The size of the string isn't known, this could easily overrun the buffer length.

Using RNA_property_string_get_alloc avoids the problem.

The size of the string isn't known, this could easily overrun the buffer length. Using `RNA_property_string_get_alloc` avoids the problem.
}
# ifdef USE_ALLSELECT_LAYER_HACK
@ -2035,6 +2035,9 @@ static void ui_selectcontext_apply(bContext *C,
RNA_property_update(C, &lptr, prop);
}
if (rna_type == PROP_STRING) {
MEM_freeN(delta.str);
}
}
}