Depsgraph: Fix 'use after free' error in some cases during undo step #106661
|
@ -54,7 +54,7 @@ string ComponentNode::OperationIDKey::identifier() const
|
|||
|
||||
bool ComponentNode::OperationIDKey::operator==(const OperationIDKey &other) const
|
||||
{
|
||||
return (opcode == other.opcode) && STREQ(name, other.name) && (name_tag == other.name_tag);
|
||||
return (opcode == other.opcode) && (name == other.name) && (name_tag == other.name_tag);
|
||||
}
|
||||
|
||||
uint64_t ComponentNode::OperationIDKey::hash() const
|
||||
|
@ -63,7 +63,7 @@ uint64_t ComponentNode::OperationIDKey::hash() const
|
|||
return BLI_ghashutil_combine_hash(
|
||||
name_tag,
|
||||
BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(opcode_as_int),
|
||||
BLI_ghashutil_strhash_p(name)));
|
||||
BLI_ghashutil_strhash_p(name.c_str())));
|
||||
}
|
||||
|
||||
ComponentNode::ComponentNode()
|
||||
|
@ -106,7 +106,7 @@ OperationNode *ComponentNode::find_operation(OperationIDKey key) const
|
|||
else {
|
||||
for (OperationNode *op_node : operations) {
|
||||
if (op_node->opcode == key.opcode && op_node->name_tag == key.name_tag &&
|
||||
STREQ(op_node->name.c_str(), key.name)) {
|
||||
op_node->name == key.name) {
|
||||
node = op_node;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ struct ComponentNode : public Node {
|
|||
/* Key used to look up operations within a component */
|
||||
struct OperationIDKey {
|
||||
OperationCode opcode;
|
||||
const char *name;
|
||||
string name;
|
||||
int name_tag;
|
||||
|
||||
OperationIDKey();
|
||||
|
|
|
@ -45,14 +45,14 @@ IDNode::ComponentIDKey::ComponentIDKey(NodeType type, const char *name) : type(t
|
|||
|
||||
bool IDNode::ComponentIDKey::operator==(const ComponentIDKey &other) const
|
||||
{
|
||||
return type == other.type && STREQ(name, other.name);
|
||||
return type == other.type && name == other.name;
|
||||
}
|
||||
|
||||
uint64_t IDNode::ComponentIDKey::hash() const
|
||||
{
|
||||
const int type_as_int = int(type);
|
||||
return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(type_as_int),
|
||||
BLI_ghashutil_strhash_p(name));
|
||||
BLI_ghashutil_strhash_p(name.c_str()));
|
||||
}
|
||||
|
||||
void IDNode::init(const ID *id, const char * /*subdata*/)
|
||||
|
|
|
@ -38,7 +38,7 @@ struct IDNode : public Node {
|
|||
bool operator==(const ComponentIDKey &other) const;
|
||||
|
||||
NodeType type;
|
||||
const char *name;
|
||||
string name;
|
||||
};
|
||||
|
||||
/** Initialize 'id' node - from pointer data given. */
|
||||
|
|
Loading…
Reference in New Issue