From: eap Date: Mon, 15 Oct 2012 14:27:55 +0000 (+0000) Subject: Avoid referencing memory of an automatic variable X-Git-Tag: V6_6_0a1~28 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=0f6b40b23950ac328d92f87713dd6d24dc5db452 Avoid referencing memory of an automatic variable struct StdParam { - const char* text() const { return myText.toLatin1().constData(); } + const char* text() const { + ((QByteArray&) myTextAsBytes) = myText.toLatin1(); return myTextAsBytes.constData(); + } --- diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index c15484b84..bb5d9f8ac 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.h +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.h @@ -78,14 +78,17 @@ signals: protected: struct StdParam { - QString myName; - QVariant myValue; - bool isVariable; - QString myText; - StdParam(){ + QString myName; + QVariant myValue; + bool isVariable; + QString myText; + QByteArray myTextAsBytes; + StdParam() { isVariable = false; } - const char* text() const { return myText.toLatin1().constData(); } + const char* text() const { + ((QByteArray&) myTextAsBytes) = myText.toLatin1(); return myTextAsBytes.constData(); + } }; typedef QList ListOfStdParams;