rename old wxAppConsole to wxAppConsoleBase and wxAppConsoleUnix to wxAppConsole for consistency with wxAppBase/wxApp and to fix the bug 1729377 (crash when using timers under Unix in console app); also #define wxApp as wxAppConsole instead of declaring it as a real class in console build to avoid problems with ODR violation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46325 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -12,19 +12,12 @@
|
||||
#include "wx/log.h"
|
||||
#include "wx/evtloop.h"
|
||||
|
||||
//this code should not be compiled when GUI is defined
|
||||
//(monolithic build issue)
|
||||
#if !wxUSE_GUI
|
||||
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
bool wxAppConsoleUnix::Initialize(int& argc, wxChar** argv)
|
||||
bool wxAppConsole::Initialize(int& argc, wxChar** argv)
|
||||
{
|
||||
if ( !wxAppConsole::Initialize(argc,argv) )
|
||||
return false;
|
||||
|
||||
if ( !m_mainLoop->IsOk() )
|
||||
if ( !wxAppConsoleBase::Initialize(argc,argv) )
|
||||
return false;
|
||||
|
||||
sigemptyset(&m_signalsCaught);
|
||||
@@ -32,9 +25,9 @@ bool wxAppConsoleUnix::Initialize(int& argc, wxChar** argv)
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxAppConsoleUnix::HandleSignal(int signal)
|
||||
void wxAppConsole::HandleSignal(int signal)
|
||||
{
|
||||
wxAppConsoleUnix * const app = wxTheApp;
|
||||
wxAppConsole * const app = wxTheApp;
|
||||
if ( !app )
|
||||
return;
|
||||
|
||||
@@ -42,7 +35,7 @@ void wxAppConsoleUnix::HandleSignal(int signal)
|
||||
app->WakeUpIdle();
|
||||
}
|
||||
|
||||
void wxAppConsoleUnix::CheckSignal()
|
||||
void wxAppConsole::CheckSignal()
|
||||
{
|
||||
for ( SignalHandlerHash::iterator it = m_signalHandlerHash.begin();
|
||||
it != m_signalHandlerHash.end();
|
||||
@@ -57,13 +50,13 @@ void wxAppConsoleUnix::CheckSignal()
|
||||
}
|
||||
}
|
||||
|
||||
bool wxAppConsoleUnix::SetSignalHandler(int signal, SignalHandler handler)
|
||||
bool wxAppConsole::SetSignalHandler(int signal, SignalHandler handler)
|
||||
{
|
||||
const bool install = handler != SIG_DFL && handler != SIG_IGN;
|
||||
|
||||
struct sigaction sa;
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_handler = &wxAppConsoleUnix::HandleSignal;
|
||||
sa.sa_handler = &wxAppConsole::HandleSignal;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
int res = sigaction(signal, &sa, 0);
|
||||
if ( res != 0 )
|
||||
@@ -80,4 +73,3 @@ bool wxAppConsoleUnix::SetSignalHandler(int signal, SignalHandler handler)
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // !wxUSE_GUI
|
||||
|
||||
Reference in New Issue
Block a user