]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/appbase.cpp
don't call gtk_selection_data_set_text() with non-UTF-8 data as we did in ANSI build...
[wxWidgets.git] / src / common / appbase.cpp
index 857b15782262b7d88151830fdf75b248331fc39d..54cc271c41f14b70380730401a736a7a50eefec2 100644 (file)
@@ -167,22 +167,18 @@ wxAppConsoleBase::~wxAppConsoleBase()
 // initilization/cleanup
 // ----------------------------------------------------------------------------
 
-bool wxAppConsoleBase::Initialize(int& argcOrig, wxChar **argvOrig)
+bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **argv)
 {
 #if wxUSE_INTL
     GetTraits()->SetLocale();
 #endif // wxUSE_INTL
 
-    // remember the command line arguments
-    argc = argcOrig;
-    argv = argvOrig;
-
 #if wxUSE_THREADS
     wxPendingEventsLocker = new wxCriticalSection;
 #endif
 
 #ifndef __WXPALMOS__
-    if ( m_appName.empty() && argv )
+    if ( m_appName.empty() && argv && argv[0] )
     {
         // the application name is, by default, the name of its executable file
         wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL);
@@ -294,6 +290,13 @@ wxAppTraits *wxAppConsoleBase::GetTraits()
     return m_traits;
 }
 
+/* static */
+wxAppTraits *wxAppConsoleBase::GetTraitsIfExists()
+{
+    wxAppConsole * const app = GetInstance();
+    return app ? app->GetTraits() : NULL;
+}
+
 // ----------------------------------------------------------------------------
 // event processing
 // ----------------------------------------------------------------------------
@@ -677,12 +680,16 @@ void wxAppTraitsBase::MutexGuiLeave()
 
 void WXDLLIMPEXP_BASE wxMutexGuiEnter()
 {
-    wxAppConsoleBase::GetInstance()->GetTraits()->MutexGuiEnter();
+    wxAppTraits * const traits = wxAppConsoleBase::GetTraitsIfExists();
+    if ( traits )
+        traits->MutexGuiEnter();
 }
 
 void WXDLLIMPEXP_BASE wxMutexGuiLeave()
 {
-    wxAppConsoleBase::GetInstance()->GetTraits()->MutexGuiLeave();
+    wxAppTraits * const traits = wxAppConsoleBase::GetTraitsIfExists();
+    if ( traits )
+        traits->MutexGuiLeave();
 }
 #endif // wxUSE_THREADS