mirror of
https://github.com/debauchee/barrier.git
synced 2025-07-18 00:47:43 +02:00
* fixed a shit-ton of memory leaks (lots in the ipc log handler, oops)
* added non-pod data support to events (event delete can now call dtors) * improved cleanup of ipc message objects (because of non-pod event data support) * moved the "message received" event up to ipc server and client (passed on from proxies)
This commit is contained in:
parent
21cf3f2478
commit
8bad45e8a2
37 changed files with 697 additions and 396 deletions
|
@ -248,6 +248,11 @@ CApp::run(int argc, char** argv)
|
|||
CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
|
||||
#endif
|
||||
|
||||
CArch arch;
|
||||
arch.init();
|
||||
|
||||
CLog log;
|
||||
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
// dock hide only supported on lion :(
|
||||
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||
|
@ -348,28 +353,27 @@ CApp::initApp(int argc, const char** argv)
|
|||
void
|
||||
CApp::initIpcClient()
|
||||
{
|
||||
// TODO: delete ipc client on shutdown and the 2 event handlers.
|
||||
m_ipcClient = new CIpcClient();
|
||||
m_ipcClient->connect();
|
||||
|
||||
EVENTQUEUE->adoptHandler(
|
||||
CIpcClient::getConnectedEvent(), m_ipcClient,
|
||||
new TMethodEventJob<CApp>(this, &CApp::handleIpcConnected));
|
||||
CIpcClient::getMessageReceivedEvent(), m_ipcClient,
|
||||
new TMethodEventJob<CApp>(this, &CApp::handleIpcMessage));
|
||||
}
|
||||
|
||||
void
|
||||
CApp::handleIpcConnected(const CEvent& e, void*)
|
||||
CApp::cleanupIpcClient()
|
||||
{
|
||||
EVENTQUEUE->adoptHandler(
|
||||
CIpcServerProxy::getMessageReceivedEvent(), e.getData(),
|
||||
new TMethodEventJob<CApp>(this, &CApp::handleIpcMessage));
|
||||
m_ipcClient->disconnect();
|
||||
EVENTQUEUE->removeHandler(CIpcClient::getMessageReceivedEvent(), m_ipcClient);
|
||||
delete m_ipcClient;
|
||||
}
|
||||
|
||||
void
|
||||
CApp::handleIpcMessage(const CEvent& e, void*)
|
||||
{
|
||||
CIpcMessage* m = static_cast<CIpcMessage*>(e.getData());
|
||||
if (m->m_type == kIpcShutdown) {
|
||||
CIpcMessage* m = static_cast<CIpcMessage*>(e.getDataObject());
|
||||
if (m->type() == kIpcShutdown) {
|
||||
LOG((CLOG_INFO "got ipc shutdown message"));
|
||||
EVENTQUEUE->addEvent(CEvent(CEvent::kQuit));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue