From 7ab1a6b353cec62d5ad1cf9b551ea6b275645037 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sun, 12 Mar 2017 01:26:08 +0100 Subject: [PATCH] Fixed bug in FString copy constructor --- ChangeLog | 1 + src/fstring.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ade01f5b..abcf84ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * FRect can now combine two FRect objects * The FButtonGroup got the possibility of index access to a child button. + * Fixed bug in FString copy constructor 2017-03-08 Markus Gans * Improve input cursor positioning in FScrollView diff --git a/src/fstring.cpp b/src/fstring.cpp index 9338635b..ec0f5d3f 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp @@ -111,15 +111,15 @@ FString::FString (uInt len, char c) } //---------------------------------------------------------------------- -FString::FString (const FString& s) // copy constructor - : string(new wchar_t[FWDBUFFER + s.length + 1]()) - , length(s.length) - , bufsize(FWDBUFFER + s.length + 1) - , c_string(0) -{ - if ( s.string ) - std::wcscpy (string, s.string); -} +FString::FString (const FString& s) // copy constructor + : string(0) + , length(0) + , bufsize(0) + , c_string(0) +{ + if ( s.string ) + _replace (s.string); +} //---------------------------------------------------------------------- FString::FString (const std::wstring& s)