summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-03-15 23:21:51 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-03-15 23:21:51 +0000
commit969aec21520f4eff51554614bf00d5b30e68c356 (patch)
treedead0d76257047763c51e0172ab12aaf252e69c9
parentFix irritator formatting in initClassName (diff)
downloadslicer-1.4.5.tar.bz2
slicer-1.4.5.tar.xz
slicer-1.4.5.zip
Don't rely on constructor/destructor order in templates, GCC runs them backwards!slicer-1.4.5
-rw-r--r--slicer/slicer/modelPartsTypes.h4
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index 71736bf..cbd953e 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -191,8 +191,8 @@ namespace Slicer {
static const std::string * typeName;
static ModelPartPtr CreateModelPart(void *);
- static void initClassName() __attribute__ ((constructor(209)));
- static void deleteClassName() __attribute__ ((destructor(209)));
+ static void initClassName();
+ static void deleteClassName();
static void registerClass() __attribute__ ((constructor(210)));
static void unregisterClass() __attribute__ ((destructor(210)));
};
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index f9d8a4f..08c14b2 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -288,6 +288,7 @@ namespace Slicer {
template<typename T>
void ModelPartForClass<T>::registerClass()
{
+ initClassName();
ModelPartForComplexBase::registerClass(*className, typeName, &ModelPartForClass<T>::CreateModelPart);
}
@@ -295,6 +296,7 @@ namespace Slicer {
void ModelPartForClass<T>::unregisterClass()
{
ModelPartForComplexBase::unregisterClass(*className, typeName);
+ deleteClassName();
}
template<typename T>