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.
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 @@
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 @@
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 @@
return;
}
- newArray->values.push_back(visitor.value());
+ newArray->values[i] = visitor.value();
}
m_editedValue = newArray;
}