src/gui/widget/stringinput.cpp: copy valueString to value in ::exec,

to follow extenal valueString updates


Origin commit data
------------------
Commit: 22138336d4
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-11-01 (Fri, 01 Nov 2013)
This commit is contained in:
[CST] Focus
2013-11-01 16:37:29 +04:00
parent 7b165fda3e
commit 6e21f745e5

View File

@@ -84,9 +84,12 @@ CStringInput::CStringInput(const neutrino_locale_t Name, std::string* Value, int
{ {
name = Name; name = Name;
head = NULL; head = NULL;
value = NULL;
#if 0
value = new char[Size+1]; value = new char[Size+1];
value[Size] = '\0'; value[Size] = '\0';
strncpy(value,Value->c_str(),Size); strncpy(value,Value->c_str(),Size);
#endif
valueString = Value; valueString = Value;
lower_bound = -1; lower_bound = -1;
upper_bound = -1; upper_bound = -1;
@@ -121,10 +124,12 @@ CStringInput::CStringInput(char * Head, char* Value, int Size, const neutrino_lo
CStringInput::~CStringInput() CStringInput::~CStringInput()
{ {
#if 0
if (valueString != NULL) if (valueString != NULL)
{ {
delete[] value; delete[] value;
} }
#endif
if(head) { if(head) {
free(head); free(head);
} }
@@ -379,6 +384,11 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
delete[] oldval; delete[] oldval;
return res; return res;
} }
if (valueString != NULL) {
value = new char[size+1];
value[size] = '\0';
strncpy(value,valueString->c_str(),size);
}
oldval[size] = 0; oldval[size] = 0;
dispval[size] = 0; dispval[size] = 0;
@@ -531,6 +541,9 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
{ {
observ->changeNotify(name, value); observ->changeNotify(name, value);
} }
if (valueString != NULL)
delete[] value;
delete[] dispval; delete[] dispval;
delete[] oldval; delete[] oldval;
return res; return res;