wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom)
{
+ m_value.string = (wxChar*) NULL;
m_modifiedFlag = FALSE;
Copy((wxPropertyValue& )copyFrom);
}
wxNode *node = the_list->First();
while (node)
{
- char *s = (char *)node->Data();
+ wxChar *s = (wxChar *)node->Data();
Append(new wxPropertyValue(s));
node = node->Next();
}
void wxPropertyValue::Copy(wxPropertyValue& copyFrom)
{
+ if (m_type == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
m_type = copyFrom.Type();
switch (m_type)
const wxChar *val = (const wxChar *)val1;
m_modifiedFlag = TRUE;
+
+ wxPropertyValueType oldType = m_type;
+ if (oldType == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
+
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueString;
}
else if (m_type == wxPropertyValueStringPtr)
{
- if (*m_value.stringPtr)
- delete[] *m_value.stringPtr;
+ wxFAIL_MSG( wxT("Shouldn't try to assign a wxString reference to a char* pointer.") );
if (val)
*m_value.stringPtr = copystring(val);
else
void wxPropertyValue::operator=(const long val)
{
+ wxPropertyValueType oldType = m_type;
+ if (oldType == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
+
m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueInteger;
void wxPropertyValue::operator=(const bool val)
{
+ wxPropertyValueType oldType = m_type;
+ if (oldType == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
+
m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValuebool;
void wxPropertyValue::operator=(const float val)
{
+ wxPropertyValueType oldType = m_type;
+ if (oldType == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
+
m_modifiedFlag = TRUE;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueReal;
void wxPropertyValue::operator=(const wxChar **val)
{
+ wxPropertyValueType oldType = m_type;
+ if (oldType == wxPropertyValueString)
+ {
+ delete[] m_value.string ;
+ m_value.string = NULL;
+ }
+
m_modifiedFlag = TRUE;
m_type = wxPropertyValueStringPtr;