]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/appbase.cpp
fix memory leak (coverity checker CID 53)
[wxWidgets.git] / src / common / appbase.cpp
index 07732a2d9debfc9970fb42f6a7b206c772338f12..fd408ab0d95aee5ac8c709687e25a03a0d68aa69 100644 (file)
@@ -144,11 +144,11 @@ wxAppConsole::~wxAppConsole()
 // initilization/cleanup
 // ----------------------------------------------------------------------------
 
-bool wxAppConsole::Initialize(int& argc, wxChar **argv)
+bool wxAppConsole::Initialize(int& argcOrig, wxChar **argvOrig)
 {
     // remember the command line arguments
-    this->argc = argc;
-    this->argv = argv;
+    argc = argcOrig;
+    argv = argvOrig;
 
 #ifndef __WXPALMOS__
     if ( m_appName.empty() && argv )
@@ -207,10 +207,6 @@ int wxAppConsole::OnExit()
     delete wxConfigBase::Set((wxConfigBase *) NULL);
 #endif // wxUSE_CONFIG
 
-    // use Set(NULL) and not Get() to avoid creating a message output object on
-    // demand when we just want to delete it
-    delete wxMessageOutput::Set(NULL);
-
     return 0;
 }
 
@@ -324,17 +320,6 @@ wxAppConsole::HandleEvent(wxEvtHandler *handler,
     (handler->*func)(event);
 }
 
-bool
-wxAppConsole::OnExceptionInMainLoop()
-{
-    throw;
-
-    // some compilers are too stupid to know that we never return after throw
-#if defined(__DMC__) || (defined(_MSC_VER) && _MSC_VER < 1200)
-    return false;
-#endif
-}
-
 #endif // wxUSE_EXCEPTIONS
 
 // ----------------------------------------------------------------------------
@@ -721,7 +706,11 @@ static wxString GetAssertStackTrace()
     protected:
         virtual void OnStackFrame(const wxStackFrame& frame)
         {
-            m_stackTrace << wxString::Format(_T("[%02d] "), frame.GetLevel());
+            m_stackTrace << wxString::Format
+                            (
+                              _T("[%02d] "),
+                              wx_truncate_cast(int, frame.GetLevel())
+                            );
 
             wxString name = frame.GetName();
             if ( !name.empty() )
@@ -730,11 +719,7 @@ static wxString GetAssertStackTrace()
             }
             else
             {
-                m_stackTrace << wxString::Format
-                                (
-                                    _T("0x%08lx"),
-                                    (unsigned long)frame.GetAddress()
-                                );
+                m_stackTrace << wxString::Format(_T("%p"), frame.GetAddress());
             }
 
             if ( frame.HasSourceLocation() )