fixed: on windows xp daemon deadlocks and synergys crashes on startup. also fixed uninitialized ipc program args value (always turning ipc on). moved the event queue further up the stack for (client, server and daemon) so that it's always available (not just in the main loop).
This commit is contained in:
parent
a62fee84cc
commit
4378e520f0
|
@ -73,8 +73,7 @@ CString
|
||||||
CArchPluginWindows::getModuleDir()
|
CArchPluginWindows::getModuleDir()
|
||||||
{
|
{
|
||||||
TCHAR c_modulePath[MAX_PATH];
|
TCHAR c_modulePath[MAX_PATH];
|
||||||
GetModuleFileName(NULL, c_modulePath, MAX_PATH);
|
if (GetModuleFileName(NULL, c_modulePath, MAX_PATH) == 0) {
|
||||||
if (GetLastError() != ERROR_SUCCESS) {
|
|
||||||
throw XArch(new XArchEvalWindows);
|
throw XArch(new XArchEvalWindows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,9 @@ CIpcLogOutputter::appendBuffer(const CString& text)
|
||||||
void
|
void
|
||||||
CIpcLogOutputter::bufferThread(void*)
|
CIpcLogOutputter::bufferThread(void*)
|
||||||
{
|
{
|
||||||
|
CArchMutexLock lock(m_notifyMutex);
|
||||||
m_bufferThreadId = m_bufferThread->getID();
|
m_bufferThreadId = m_bufferThread->getID();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while (m_running) {
|
while (m_running) {
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "TMethodEventJob.h"
|
#include "TMethodEventJob.h"
|
||||||
#include "CIpcMessage.h"
|
#include "CIpcMessage.h"
|
||||||
#include "Ipc.h"
|
#include "Ipc.h"
|
||||||
|
#include "CEventQueue.h"
|
||||||
|
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
#include "CArchMiscWindows.h"
|
#include "CArchMiscWindows.h"
|
||||||
|
@ -252,6 +253,7 @@ CApp::run(int argc, char** argv)
|
||||||
arch.init();
|
arch.init();
|
||||||
|
|
||||||
CLog log;
|
CLog log;
|
||||||
|
CEventQueue events;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_10_7
|
#if MAC_OS_X_VERSION_10_7
|
||||||
// dock hide only supported on lion :(
|
// dock hide only supported on lion :(
|
||||||
|
|
|
@ -36,7 +36,8 @@ m_pname(NULL),
|
||||||
m_logFilter(NULL),
|
m_logFilter(NULL),
|
||||||
m_logFile(NULL),
|
m_logFile(NULL),
|
||||||
m_display(NULL),
|
m_display(NULL),
|
||||||
m_enableVnc(false)
|
m_enableVnc(false),
|
||||||
|
m_enableIpc(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -526,9 +526,6 @@ CClientApp::mainLoop()
|
||||||
// on unix because threads evaporate across a fork().
|
// on unix because threads evaporate across a fork().
|
||||||
CSocketMultiplexer multiplexer;
|
CSocketMultiplexer multiplexer;
|
||||||
|
|
||||||
// create the event queue
|
|
||||||
CEventQueue eventQueue;
|
|
||||||
|
|
||||||
// start client, etc
|
// start client, etc
|
||||||
appUtil().startNode();
|
appUtil().startNode();
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ CDaemonApp::run(int argc, char** argv)
|
||||||
arch.init();
|
arch.init();
|
||||||
|
|
||||||
CLog log;
|
CLog log;
|
||||||
|
CEventQueue events;
|
||||||
|
|
||||||
bool uninstall = false;
|
bool uninstall = false;
|
||||||
try
|
try
|
||||||
|
@ -187,12 +188,13 @@ CDaemonApp::mainLoop(bool logToFile)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DAEMON_RUNNING(true);
|
DAEMON_RUNNING(true);
|
||||||
|
/*while (true)
|
||||||
|
{
|
||||||
|
}*/
|
||||||
|
|
||||||
if (logToFile)
|
if (logToFile)
|
||||||
CLOG->insert(new CFileLogOutputter(logPath().c_str()));
|
CLOG->insert(new CFileLogOutputter(logPath().c_str()));
|
||||||
|
|
||||||
CEventQueue eventQueue;
|
|
||||||
|
|
||||||
// create socket multiplexer. this must happen after daemonization
|
// create socket multiplexer. this must happen after daemonization
|
||||||
// on unix because threads evaporate across a fork().
|
// on unix because threads evaporate across a fork().
|
||||||
CSocketMultiplexer multiplexer;
|
CSocketMultiplexer multiplexer;
|
||||||
|
@ -208,7 +210,7 @@ CDaemonApp::mainLoop(bool logToFile)
|
||||||
m_relauncher = new CMSWindowsRelauncher(false, *m_ipcServer, *m_ipcLogOutputter);
|
m_relauncher = new CMSWindowsRelauncher(false, *m_ipcServer, *m_ipcLogOutputter);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
eventQueue.adoptHandler(
|
EVENTQUEUE->adoptHandler(
|
||||||
CIpcServer::getMessageReceivedEvent(), m_ipcServer,
|
CIpcServer::getMessageReceivedEvent(), m_ipcServer,
|
||||||
new TMethodEventJob<CDaemonApp>(this, &CDaemonApp::handleIpcMessage));
|
new TMethodEventJob<CDaemonApp>(this, &CDaemonApp::handleIpcMessage));
|
||||||
|
|
||||||
|
@ -230,14 +232,14 @@ CDaemonApp::mainLoop(bool logToFile)
|
||||||
m_relauncher->startAsync();
|
m_relauncher->startAsync();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
eventQueue.loop();
|
EVENTQUEUE->loop();
|
||||||
|
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
m_relauncher->stop();
|
m_relauncher->stop();
|
||||||
delete m_relauncher;
|
delete m_relauncher;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
eventQueue.removeHandler(
|
EVENTQUEUE->removeHandler(
|
||||||
CIpcServer::getMessageReceivedEvent(), m_ipcServer);
|
CIpcServer::getMessageReceivedEvent(), m_ipcServer);
|
||||||
|
|
||||||
CLOG->remove(m_ipcLogOutputter);
|
CLOG->remove(m_ipcLogOutputter);
|
||||||
|
|
|
@ -758,9 +758,6 @@ CServerApp::mainLoop()
|
||||||
// on unix because threads evaporate across a fork().
|
// on unix because threads evaporate across a fork().
|
||||||
CSocketMultiplexer multiplexer;
|
CSocketMultiplexer multiplexer;
|
||||||
|
|
||||||
// create the event queue
|
|
||||||
CEventQueue eventQueue;
|
|
||||||
|
|
||||||
// if configuration has no screens then add this system
|
// if configuration has no screens then add this system
|
||||||
// as the default
|
// as the default
|
||||||
if (args().m_config->begin() == args().m_config->end()) {
|
if (args().m_config->begin() == args().m_config->end()) {
|
||||||
|
|
Loading…
Reference in New Issue