From c65f6ddf6e16d18b117f541cbc8ac291c5db16eb Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 6 Jul 2012 15:53:29 -0400 Subject: [PATCH] gui: Fix editing of the shaders Editing shaders was broken because we were adding extra values to the arguments array. This fixes it, meaning that if you right click on glShaderSource you can edit the shader source and the rest of the trace will properly catch the changes. An incredibly useful feature. --- gui/saverthread.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gui/saverthread.cpp b/gui/saverthread.cpp index fc6a023..4ad83c5 100644 --- a/gui/saverthread.cpp +++ b/gui/saverthread.cpp @@ -247,7 +247,10 @@ public: virtual void visit(trace::String *node) { QString str = m_variant.toString(); - m_editedValue = new trace::String(str.toLocal8Bit().constData()); + char *newString = new char[str.length() + 1]; + QByteArray ba = str.toLocal8Bit(); + strcpy(newString, ba.constData()); + m_editedValue = new trace::String(newString); } virtual void visit(trace::Enum *e) @@ -273,7 +276,6 @@ public: trace::Array *newArray = new trace::Array(vals.count()); for (int i = 0; i < vals.count(); ++i) { EditVisitor visitor(vals[i]); - array->values[i]->visit(visitor); if (array->values[i] == visitor.value()) { //non-editabled @@ -282,7 +284,7 @@ public: return; } - newArray->values.push_back(visitor.value()); + newArray->values[i] = visitor.value(); } m_editedValue = newArray; } -- 2.43.0