Contents Up Previous Next

Functions that return string values cause strange behaviour on some platforms.

To resolve the question of who is responsible for allocating and deallocating memory, wxWindows maintains a policy (unless documented otherwise) of returning a temporary pointer to a static string buffer from functions such as wxText::GetValue.

If you don't immediately take a copy of this value, it's possible that subsequent wxWindows calls will use the same memory, causing unpredictable results. This tends to be more the case under Windows than other platforms, where pointers to internal XView or Motif widget strings are often returned.