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.
This commit is contained in:
Adrien Destugues
2014-10-09 21:28:18 +02:00
parent 26b0a53d12
commit d41ee54e6a
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -25,5 +25,6 @@ StatusSlider::UpdateText() const
{ {
fStr.Truncate(0); fStr.Truncate(0);
fFormat.Format(fStr, Value()); fFormat.Format(fStr, Value());
return fStr.String(); strcpy(fPattern, fStr.String());
return fPattern;
} }
+1
View File
@@ -27,6 +27,7 @@ public:
virtual const char* UpdateText() const; virtual const char* UpdateText() const;
private: private:
mutable char fPattern[256];
BMessageFormat fFormat; BMessageFormat fFormat;
mutable BString fStr; mutable BString fStr;
}; };