Fix: Escape property name when keying #119922
|
@ -10,6 +10,7 @@ set(INC
|
||||||
../../makesrna
|
../../makesrna
|
||||||
../../sequencer
|
../../sequencer
|
||||||
../../windowmanager
|
../../windowmanager
|
||||||
|
../../../../extern/fmtlib/include
|
||||||
# RNA_prototypes.h
|
# RNA_prototypes.h
|
||||||
${CMAKE_BINARY_DIR}/source/blender/makesrna
|
${CMAKE_BINARY_DIR}/source/blender/makesrna
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
#include "BLI_blenlib.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 (insert_channel_flags & USER_ANIM_KEY_CHANNEL_CUSTOM_PROPERTIES) {
|
||||||
if (properties) {
|
if (properties) {
|
||||||
LISTBASE_FOREACH (IDProperty *, prop, &properties->data.group) {
|
LISTBASE_FOREACH (IDProperty *, prop, &properties->data.group) {
|
||||||
std::string name = prop->name;
|
char name_escaped[MAX_IDPROP_NAME * 2];
|
||||||
|
|||||||
std::string rna_path = "[\"" + name + "\"]";
|
BLI_str_escape(name_escaped, prop->name, sizeof(name_escaped));
|
||||||
paths.append(rna_path);
|
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 :)