diff --git a/docs/changes.txt b/docs/changes.txt index d7c9757ddf..d5addb04c7 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -581,6 +581,7 @@ All: - Fix wxFileName::MakeRelativeTo() for directory relatively to itself. - Fix wxLocale::IsOk() return true even if setting the locale failed. +- Null-terminate wxApp::argv for compatibility with the real argv. Unix: diff --git a/include/wx/cmdargs.h b/include/wx/cmdargs.h index e4167f0fd6..62e92b7c70 100644 --- a/include/wx/cmdargs.h +++ b/include/wx/cmdargs.h @@ -51,9 +51,11 @@ public: if ( !m_argsA ) { const size_t count = m_args.size(); - m_argsA = new char *[count]; + m_argsA = new char *[count + 1]; for ( size_t n = 0; n < count; n++ ) m_argsA[n] = wxStrdup(m_args[n].ToAscii()); + + m_argsA[count] = NULL; } return m_argsA; @@ -64,9 +66,11 @@ public: if ( !m_argsW ) { const size_t count = m_args.size(); - m_argsW = new wchar_t *[count]; + m_argsW = new wchar_t *[count + 1]; for ( size_t n = 0; n < count; n++ ) m_argsW[n] = wxStrdup(m_args[n].wc_str()); + + m_argsW[count] = NULL; } return m_argsW;