From d41ee54e6a430287c6e127e6176b3bbb97164ccb Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Thu, 9 Oct 2014 21:24:33 +0200 Subject: [PATCH] Fix corrupted text in poorman slider UpdateText must return a pointer to a fixed buffer, whcih BString.String isn't, if the sctring is modified. Copy the data to a char* we can use as a fixed position buffer. --- src/apps/poorman/StatusSlider.cpp | 3 ++- src/apps/poorman/StatusSlider.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/apps/poorman/StatusSlider.cpp b/src/apps/poorman/StatusSlider.cpp index 68aad6c08b..7a08d04823 100644 --- a/src/apps/poorman/StatusSlider.cpp +++ b/src/apps/poorman/StatusSlider.cpp @@ -25,5 +25,6 @@ StatusSlider::UpdateText() const { fStr.Truncate(0); fFormat.Format(fStr, Value()); - return fStr.String(); + strcpy(fPattern, fStr.String()); + return fPattern; } diff --git a/src/apps/poorman/StatusSlider.h b/src/apps/poorman/StatusSlider.h index 1f3c53ff6a..69be9a074e 100644 --- a/src/apps/poorman/StatusSlider.h +++ b/src/apps/poorman/StatusSlider.h @@ -27,6 +27,7 @@ public: virtual const char* UpdateText() const; private: + mutable char fPattern[256]; BMessageFormat fFormat; mutable BString fStr; };