summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2010-09-01 20:10:43 +0000
committerrandomdan <randomdan@localhost>2010-09-01 20:10:43 +0000
commite92394519c5c9621784908120d12f06ad693a9b5 (patch)
treedffc3d22ea9382660fa7277a4cfb6d6b6e75f9ef
parentDrop the pain in the ass SHM session container in favour of an XML one (diff)
downloadproject2-e92394519c5c9621784908120d12f06ad693a9b5.tar.bz2
project2-e92394519c5c9621784908120d12f06ad693a9b5.tar.xz
project2-e92394519c5c9621784908120d12f06ad693a9b5.zip
Add some missing virtual destructors
Unregister VariableParent row use when destroyed
-rw-r--r--project2/perRowValues.cpp19
-rw-r--r--project2/perRowValues.h5
-rw-r--r--project2/variables.cpp13
-rw-r--r--project2/variables.h2
4 files changed, 32 insertions, 7 deletions
diff --git a/project2/perRowValues.cpp b/project2/perRowValues.cpp
index f5cd2e7..9f80924 100644
--- a/project2/perRowValues.cpp
+++ b/project2/perRowValues.cpp
@@ -1,6 +1,7 @@
#include "perRowValues.h"
#include <cstdlib>
#include <boost/foreach.hpp>
+#include <syslog.h>
PerRowValues::RowValuesStack PerRowValues::stack;
@@ -13,6 +14,18 @@ PerRowValues::~PerRowValues()
}
void
+PerRowValues::use(const RowUser * r) const
+{
+ rowUsers.insert(r);
+}
+
+void
+PerRowValues::finish(const RowUser * r) const
+{
+ rowUsers.erase(r);
+}
+
+void
PerRowValues::beginRow(const PerRowValues * r)
{
stack.push_back(r);
@@ -22,6 +35,7 @@ void
PerRowValues::endRow(const PerRowValues * r)
{
if ((*stack.rbegin()) != r) {
+ syslog(LOG_ERR, "PerRowValues::endRow: stack is corrupted");
std::abort();
}
stack.pop_back();
@@ -38,8 +52,3 @@ RowUser::~RowUser()
{
}
-void
-RowUser::rowChanged() const
-{
-}
-
diff --git a/project2/perRowValues.h b/project2/perRowValues.h
index 46445ee..9d4e7a8 100644
--- a/project2/perRowValues.h
+++ b/project2/perRowValues.h
@@ -8,7 +8,7 @@
class RowUser {
public:
RowUser();
- ~RowUser();
+ virtual ~RowUser() = 0;
virtual void rowChanged() const = 0;
};
@@ -25,7 +25,8 @@ class PerRowValues {
virtual const Glib::ustring & getColumnName(unsigned int col) const = 0;
virtual const Glib::ustring & getCurrentValue(const Glib::ustring & id) const = 0;
virtual const Glib::ustring & getCurrentValue(unsigned int col) const = 0;
- void use(const RowUser * r) const { rowUsers.insert(r); }
+ void use(const RowUser * r) const;
+ void finish(const RowUser * r) const;
static const RowValuesStack & Stack() { return stack; }
static void beginRow(const PerRowValues * r);
diff --git a/project2/variables.cpp b/project2/variables.cpp
index 1a16c4b..3c27d44 100644
--- a/project2/variables.cpp
+++ b/project2/variables.cpp
@@ -94,6 +94,15 @@ class VariableParent : public VariableImplDyn, public RowUser {
dep(d)
{
}
+ ~VariableParent()
+ {
+ if (row) {
+ row->finish(this);
+ if (dep) {
+ row->finish(dep);
+ }
+ }
+ }
const Glib::ustring & value() const
{
if (!cacheValid) {
@@ -227,3 +236,7 @@ VariableImpl::VariableImpl(const Glib::ustring & src) :
}
}
+VariableImpl::~VariableImpl()
+{
+}
+
diff --git a/project2/variables.h b/project2/variables.h
index 1d4b4ba..c927ae6 100644
--- a/project2/variables.h
+++ b/project2/variables.h
@@ -16,6 +16,8 @@ class VariableImpl : public virtual IntrusivePtrBase {
protected:
VariableImpl(const Glib::ustring & src);
+ virtual ~VariableImpl() = 0;
+
const Glib::ustring source;
Glib::ustring name;
boost::optional<Glib::ustring> defaultValue;