From e47a3b95a22e56144521081e9f0871a31a8b8b4c Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 2 Mar 2015 11:34:36 +0300 Subject: [PATCH] Fix bug: function toUtf8() returns pointer to the temporarily allocated data --- src/VTKViewer/VTKViewer_FramedTextActor.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(); } -- 2.39.2