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