Extension: Fix order-of-initialisation crash

FreeCADs property system utilises some pointer math to calculate the offset between
property and base class. Due to virtual inheritance of th ePropertyContainer the memory
layout has been changed to rather random, which has lead to crashes dependend on the
order of object initialisation.

The solution is to not make PropertyContaner virtual but a class below, Base::Persitance.
Then the memory layout is random for Persistance, but it is perfectly aligned for the
base class chains from PropertyContainer onwards as well as from Extension onwards.
Hence the proeprty system was changed to take the offset always from those two.
This commit is contained in:
Stefan Tröger
2016-09-21 06:25:51 +02:00
committed by wmayer
parent fc34fc2f2f
commit 89bbb81521
31 changed files with 310 additions and 169 deletions

View File

@@ -33,7 +33,7 @@
using namespace App;
PROPERTY_SOURCE(App::DocumentObjectExtension, App::Extension)
EXTENSION_PROPERTY_SOURCE(App::DocumentObjectExtension, App::Extension)
DocumentObjectExtension::DocumentObjectExtension()
{