GeoDataFeature & GeoDataGeometry: implicit sharing vs. owner pointers?

Friedrich W. H. Kossebau kossebau at kde.org
Fri Oct 7 17:20:04 UTC 2016


Hi,

GeoDataFeature & GeoDataGeometry and their subclasses are implemented to do 
"implicit sharing" between object copies. src/lib/marble/geodata/data/
README.html reasons:
"Each derived class can be stored in its base class and can later be 
transformed back again. [...] This feature is useful so that you can easily 
store classes which inherit GeoDataFeature in a QVector<GeoDataFeature> [...]"

At the same time though the data objects belonging to those two classes and 
their subclasses get a pointer set to their "parent" object. Which poses a 
challenge: for objects implicitely shared, what is the parent object?
E.g. think of lifetime of the parents:
	Foo b;
	{
		Foo a;
		a.addObjectAndMarkSelfAsParent(o);
		b = a;
	}  // a goes out of scope

Grepping through the code it seems though that GeoDataFeature & 
GeoDataGeometry almost everywhere are handled by pointer, not by value. 

And the current code in many places after a detach does not go over all owned 
objects and properly updates the parent.

So I wonder if the application of implicit sharing for the cited motivation 
never worked out due to the given challenge and all code simply escaped into 
using pointers, but no-one ever got around to also dump that implicit sharing 
code?

Does it make sense to start to try to remove that implicit sharing code?
What have I missed possibly?

Cheers
Friedrich


More information about the Marble-devel mailing list