Properly deal with classes destructors

There are some classes such as AuditLog that demands a reference count. That is
needed because this class can be used by different instances of the Rules
classes.
This commit is contained in:
Felipe Zimmerle
2015-07-13 12:28:25 -03:00
parent 0c98bdc80b
commit 001d5ebf7f
13 changed files with 100 additions and 18 deletions

View File

@@ -31,10 +31,22 @@ class AuditLogWriterParallel : public AuditLogWriter {
explicit AuditLogWriterParallel(AuditLog *audit)
: AuditLogWriter(audit) { }
~AuditLogWriterParallel() { }
bool init() override;
bool close() override;
bool write(Assay *assay, int parts) override;
void refCountIncrease() override {
m_refereceCount++;
}
void refCountDecreaseAndCheck() override {
m_refereceCount--;
if (m_refereceCount == 0) {
delete this;
}
}
/**
*
* Audit log file is saved into a directory structure. This directory