[Bf-blender-cvs] [0b45a2f] depsgraph_refactor: Depsgraph: Fix wrong memory access in debug dump
Sergey Sharybin
noreply at git.blender.org
Fri Dec 19 13:51:33 CET 2014
Commit: 0b45a2fae7054204012d81539ef62e6cf44297e1
Author: Sergey Sharybin
Date: Fri Dec 19 17:50:26 2014 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB0b45a2fae7054204012d81539ef62e6cf44297e1
Depsgraph: Fix wrong memory access in debug dump
It's not possible to have stuff like
const char *foo = bar().c_str()
in cases when bar() returns dynamically allocated string.
===================================================================
M source/blender/depsgraph/intern/depsgraph_debug.cpp
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cpp b/source/blender/depsgraph/intern/depsgraph_debug.cpp
index b7e1c52..c6ae0f9 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cpp
@@ -362,19 +362,19 @@ static void deg_debug_graphviz_node_style(const DebugContext &ctx, const DepsNod
static void deg_debug_graphviz_node_single(const DebugContext &ctx, const DepsNode *node)
{
const char *shape = "box";
- const char *name = node->identifier().c_str();
+ const string name = node->identifier();
float priority = -1.0f;
if (ctx.show_eval_priority && node->tclass == DEPSNODE_CLASS_OPERATION)
priority = ((OperationDepsNode *)node)->eval_priority;
- deg_debug_printf(ctx, "// %s\n", name);
+ deg_debug_printf(ctx, "// %s\n", name.c_str());
deg_debug_printf(ctx, "\"node_%p\"", node);
deg_debug_printf(ctx, "[");
// deg_debug_printf(ctx, "label=<<B>%s</B>>", name);
if (priority >= 0.0f)
- deg_debug_printf(ctx, "label=<%s<BR/>(<I>%.2f</I>)>", name, priority);
+ deg_debug_printf(ctx, "label=<%s<BR/>(<I>%.2f</I>)>", name.c_str(), priority);
else
- deg_debug_printf(ctx, "label=<%s>", name);
+ deg_debug_printf(ctx, "label=<%s>", name.c_str());
deg_debug_printf(ctx, ",fontname=\"%s\"", deg_debug_graphviz_fontname);
deg_debug_printf(ctx, ",fontsize=%f", deg_debug_graphviz_node_label_size);
deg_debug_printf(ctx, ",shape=%s", shape);
@@ -389,12 +389,12 @@ static void deg_debug_graphviz_node_single(const DebugContext &ctx, const DepsNo
static void deg_debug_graphviz_node_cluster_begin(const DebugContext &ctx, const DepsNode *node)
{
- const char *name = node->identifier().c_str();
+ const string name = node->identifier().c_str();
- deg_debug_printf(ctx, "// %s\n", name);
+ deg_debug_printf(ctx, "// %s\n", name.c_str());
deg_debug_printf(ctx, "subgraph \"cluster_%p\" {" NL, node);
// deg_debug_printf(ctx, "label=<<B>%s</B>>;" NL, name);
- deg_debug_printf(ctx, "label=<%s>;" NL, name);
+ deg_debug_printf(ctx, "label=<%s>;" NL, name.c_str());
deg_debug_printf(ctx, "fontname=\"%s\";" NL, deg_debug_graphviz_fontname);
deg_debug_printf(ctx, "fontsize=%f;" NL, deg_debug_graphviz_node_label_size);
deg_debug_printf(ctx, "style="); deg_debug_graphviz_node_style(ctx, node); deg_debug_printf(ctx, ";" NL);
More information about the Bf-blender-cvs
mailing list