Fix: GPv3 layer renaming when name is unchanged #111173
@ -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
|
/* 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
|
* store the new name, restore the old name in the node, and then call the rename
|
||||||
* function. */
|
* function. */
|
||||||
|
|
||||||
|
|||||||
std::string new_name(node.name);
|
std::string new_name(node.name);
|
||||||
node.name = oldname;
|
node.name = BLI_strdup(oldname);
|
||||||
Falk David
commented
`sizeof(oldname)` is a pointer, this won't work. But you can use `node.name = BLI_strdup(oldname)` which will call `strlen` internally.
|
|||||||
|
|
||||||
if (node.is_group()) {
|
if (node.is_group()) {
|
||||||
grease_pencil.rename_group(node.as_group_for_write(), new_name);
|
grease_pencil.rename_group(node.as_group_for_write(), new_name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user
If the issue is that the
node.name
points tooldname
shouldn't this compare the pointers instead of the string?node.name
points to oldname after thisif block
(see line 871 in PR 😅 )Ah, of course. Then I think the right thing to do is call
STRNCPY(node.name, oldname);
instead ofnode.name = oldname;