From: vsr Date: Mon, 2 Mar 2015 08:34:36 +0000 (+0300) Subject: Fix bug: function toUtf8() returns pointer to the temporarily allocated data X-Git-Tag: V7_6_0a1~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e47a3b95a22e56144521081e9f0871a31a8b8b4c;p=modules%2Fgui.git Fix bug: function toUtf8() returns pointer to the temporarily allocated data --- diff --git a/src/VTKViewer/VTKViewer_FramedTextActor.cxx b/src/VTKViewer/VTKViewer_FramedTextActor.cxx index a902d92a6..21fde365c 100644 --- a/src/VTKViewer/VTKViewer_FramedTextActor.cxx +++ b/src/VTKViewer/VTKViewer_FramedTextActor.cxx @@ -52,7 +52,7 @@ namespace return QString( txt ); #endif } - const char* toUtf8( const QString& txt ) + std::string toUtf8( const QString& txt ) { #ifdef PAL22528_UNICODE return txt.toUtf8().constData(); @@ -300,7 +300,7 @@ void VTKViewer_FramedTextActor::SetText(const char* theText) while(anIter.hasNext()) aTrimmedStringList.append(anIter.next().trimmed()); - myTextActor->SetInput(toUtf8(aTrimmedStringList.join("\n"))); + myTextActor->SetInput(toUtf8(aTrimmedStringList.join("\n")).c_str()); Modified(); }