summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cppe
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2006-07-13 06:02:58 +0000
committerMichi Henning <michi@zeroc.com>2006-07-13 06:02:58 +0000
commit20087fd26e253755d9ea223ede49a4416fa2a0da (patch)
tree4e9509ca022c91e1013c7c00f60fed42a141a189 /cpp/src/slice2cppe
parentchanging icephp embedded libpath to refer to the intended Ice installation (diff)
downloadice-20087fd26e253755d9ea223ede49a4416fa2a0da.tar.bz2
ice-20087fd26e253755d9ea223ede49a4416fa2a0da.tar.xz
ice-20087fd26e253755d9ea223ede49a4416fa2a0da.zip
Added protected destructor to non-abstract Slice classes.
Diffstat (limited to 'cpp/src/slice2cppe')
-rw-r--r--cpp/src/slice2cppe/Gen.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp
index c9e77de1445..8455816dbbc 100644
--- a/cpp/src/slice2cppe/Gen.cpp
+++ b/cpp/src/slice2cppe/Gen.cpp
@@ -2078,6 +2078,17 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
}
+ //
+ // We add a protected destructor to force heap instantiation of the class.
+ //
+ if(!p->isAbstract())
+ {
+ H.dec();
+ H << sp << nl << "protected:";
+ H.inc();
+ H << sp << nl << "virtual ~" << fixKwd(p->name()) << "() {}";
+ }
+
H << eb << ';';
if(!p->isLocal())