Fix: GPv3 layer renaming when name is unchanged
When old and new names of layers/groups are same, garbage string is displayed. This is because `oldname` char pointer is referenced to `node.name`. After function execution, `oldname` memory is freed in `interface_handler` (see `after.rename_orig`), thus displays garbage string. Fix is to copy the content of `oldname` instead of referencing it. Pull Request: https://projects.blender.org/blender/blender/pulls/111173
This commit is contained in:
committed by
Pratik Borhade
parent
85a3f61150
commit
338e4ef090
@@ -864,8 +864,10 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
|
||||
/* The node already has the new name set. To properly rename the node, we need to first
|
||||
* store the new name, restore the old name in the node, and then call the rename
|
||||
* function. */
|
||||
|
||||
std::string new_name(node.name);
|
||||
node.name = oldname;
|
||||
node.name = BLI_strdup(oldname);
|
||||
|
||||
if (node.is_group()) {
|
||||
grease_pencil.rename_group(node.as_group_for_write(), new_name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user