Fix: Escape property name when keying #119922
|
@ -10,6 +10,7 @@ set(INC
|
|||
../../makesrna
|
||||
../../sequencer
|
||||
../../windowmanager
|
||||
../../../../extern/fmtlib/include
|
||||
# RNA_prototypes.h
|
||||
${CMAKE_BINARY_DIR}/source/blender/makesrna
|
||||
)
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
|
@ -298,9 +300,9 @@ static blender::Vector<std::string> construct_rna_paths(PointerRNA *ptr)
|
|||
if (insert_channel_flags & USER_ANIM_KEY_CHANNEL_CUSTOM_PROPERTIES) {
|
||||
if (properties) {
|
||||
LISTBASE_FOREACH (IDProperty *, prop, &properties->data.group) {
|
||||
std::string name = prop->name;
|
||||
std::string rna_path = "[\"" + name + "\"]";
|
||||
paths.append(rna_path);
|
||||
char name_escaped[MAX_IDPROP_NAME * 2];
|
||||
|
||||
BLI_str_escape(name_escaped, prop->name, sizeof(name_escaped));
|
||||
paths.append(fmt::format("[\"{}\"]", name_escaped));
|
||||
}
|
||||
Hans Goudey
commented
To avoid copying the string, use To avoid copying the string, use `std::move` or put the `fmt::format` call directly inside `append(..)`
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
This will leak the result of
BLI_sprintfN
which allocates achar *
. It should be replaced byfmt::format
thanks, changed :)