* 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:
Nick Bolton
2012-07-10 01:51:51 +00:00
parent 21cf3f2478
commit 8bad45e8a2
37 changed files with 697 additions and 396 deletions

View File

@@ -21,6 +21,12 @@
#include "BasicTypes.h"
#include "stdmap.h"
class CEventData {
public:
CEventData() { }
virtual ~CEventData() { }
};
//! Event
/*!
A \c CEvent holds an event type and a pointer to event data.
@@ -45,13 +51,15 @@ public:
CEvent();
//! Create \c CEvent with data
//! Create \c CEvent with data (POD)
/*!
The \p type must have been registered using \c registerType().
The \p data must be POD (plain old data) allocated by malloc(),
which means it cannot have a constructor, destructor or be
composed of any types that do. \p target is the intended
recipient of the event. \p flags is any combination of \c Flags.
composed of any types that do. For non-POD (normal C++ objects
use \c setDataObject().
\p target is the intended recipient of the event.
\p flags is any combination of \c Flags.
*/
CEvent(Type type, void* target = NULL, void* data = NULL,
Flags flags = kNone);
@@ -64,6 +72,13 @@ public:
Deletes event data for the given event (using free()).
*/
static void deleteData(const CEvent&);
//! Set data (non-POD)
/*!
Set non-POD (non plain old data), where delete is called when the event
is deleted, and the destructor is called.
*/
void setDataObject(CEventData* dataObject);
//@}
//! @name accessors
@@ -81,12 +96,20 @@ public:
*/
void* getTarget() const;
//! Get the event data
//! Get the event data (POD).
/*!
Returns the event data.
Returns the event data (POD).
*/
void* getData() const;
//! Get the event data (non-POD)
/*!
Returns the event data (non-POD). The difference between this and
\c getData() is that when delete is called on this data, so non-POD
(non plain old data) dtor is called.
*/
CEventData* getDataObject() const;
//! Get event flags
/*!
Returns the event flags.
@@ -100,6 +123,7 @@ private:
void* m_target;
void* m_data;
Flags m_flags;
CEventData* m_dataObject;
};
#endif