Fix: Node editor drawing stack use after scope
Caused by a bad conversion to StringRef in 950a2bb8a3.
Instead pass around StringRef since that's all that's needed by the UI code
anyway. And make the argument to the node socket drawing RNA function
clearer, previously it relied on the char pointer being first in StringRefNull.
Pull Request: https://projects.blender.org/blender/blender/pulls/146985
This commit is contained in:
@@ -167,7 +167,7 @@ struct bNodeSocketType {
|
||||
uiLayout *layout,
|
||||
PointerRNA *ptr,
|
||||
PointerRNA *node_ptr,
|
||||
StringRefNull text) = nullptr;
|
||||
StringRef text) = nullptr;
|
||||
void (*draw_color)(bContext *C, PointerRNA *ptr, PointerRNA *node_ptr, float *r_color) = nullptr;
|
||||
void (*draw_color_simple)(const bNodeSocketType *socket_type, float *r_color) = nullptr;
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ static void draw_node_input(bContext *C,
|
||||
|
||||
PointerRNA socket_ptr = RNA_pointer_create_discrete(
|
||||
node_ptr->owner_id, &RNA_NodeSocket, &socket);
|
||||
const StringRefNull text(
|
||||
CTX_IFACE_(bke::node_socket_translation_context(socket), bke::node_socket_label(socket)));
|
||||
const StringRef text = CTX_IFACE_(bke::node_socket_translation_context(socket),
|
||||
bke::node_socket_label(socket));
|
||||
uiLayout *row = &layout->row(true);
|
||||
socket.typeinfo->draw(C, row, &socket_ptr, node_ptr, text);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ static void node_socket_button_label(bContext * /*C*/,
|
||||
uiLayout *layout,
|
||||
PointerRNA * /*ptr*/,
|
||||
PointerRNA * /*node_ptr*/,
|
||||
const StringRefNull text)
|
||||
const StringRef text)
|
||||
{
|
||||
layout->label(text, ICON_NONE);
|
||||
}
|
||||
@@ -868,7 +868,7 @@ static void node_socket_undefined_draw(bContext * /*C*/,
|
||||
uiLayout *layout,
|
||||
PointerRNA * /*ptr*/,
|
||||
PointerRNA * /*node_ptr*/,
|
||||
StringRefNull /*text*/)
|
||||
StringRef /*text*/)
|
||||
{
|
||||
layout->label(IFACE_("Undefined Socket Type"), ICON_ERROR);
|
||||
}
|
||||
@@ -1071,7 +1071,7 @@ static void draw_node_socket_without_value(uiLayout *layout,
|
||||
}
|
||||
|
||||
static void std_node_socket_draw(
|
||||
bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, StringRefNull label)
|
||||
bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, StringRef label)
|
||||
{
|
||||
bNode *node = (bNode *)node_ptr->data;
|
||||
bNodeSocket *sock = (bNodeSocket *)ptr->data;
|
||||
@@ -1086,7 +1086,7 @@ static void std_node_socket_draw(
|
||||
}
|
||||
|
||||
const bool optional_label = (socket_decl && socket_decl->optional_label) || label.is_empty();
|
||||
const StringRefNull label_or_empty = optional_label ? "" : label;
|
||||
const StringRef label_or_empty = optional_label ? "" : label;
|
||||
|
||||
const bool has_gizmo = tree->runtime->gizmo_propagation ?
|
||||
tree->runtime->gizmo_propagation->gizmo_endpoint_sockets.contains(
|
||||
|
||||
@@ -72,7 +72,7 @@ static void rna_NodeSocket_draw(bContext *C,
|
||||
uiLayout *layout,
|
||||
PointerRNA *ptr,
|
||||
PointerRNA *node_ptr,
|
||||
const blender::StringRefNull text)
|
||||
const blender::StringRef text)
|
||||
{
|
||||
bNodeSocket *sock = static_cast<bNodeSocket *>(ptr->data);
|
||||
ParameterList list;
|
||||
@@ -84,7 +84,9 @@ static void rna_NodeSocket_draw(bContext *C,
|
||||
RNA_parameter_set_lookup(&list, "context", &C);
|
||||
RNA_parameter_set_lookup(&list, "layout", &layout);
|
||||
RNA_parameter_set_lookup(&list, "node", node_ptr);
|
||||
RNA_parameter_set_lookup(&list, "text", &text);
|
||||
const std::string text_str = text;
|
||||
const char *text_c_str = text_str.c_str();
|
||||
RNA_parameter_set_lookup(&list, "text", &text_c_str);
|
||||
sock->typeinfo->ext_socket.call(C, ptr, func, &list);
|
||||
|
||||
RNA_parameter_list_free(&list);
|
||||
|
||||
Reference in New Issue
Block a user