company logo

Closing property handles

Property handles are closed automatically, when being destroyed. Property handles are also closed automatically, when opening another property with the same property handle. Sometimes, it makes also sense to close the property handle explicitly calling the close() function.

When destroying an access node, which refers to modified instance data, the instance modifications are stored to the database before closing the access node. Closing a property handle will reduce the reference count in the access node referred to by the property handle. When the reference count becomes 0, the access node will be deleted. In order to force destroying the access node, one may call Property::closeAll() with the property handle.

Destroying an access node will automatically close all property handles referring to it. Thus, property handles may become invalid, because of being closed implicitly. Implicitly destroyed property nodes are destroyed bottom-up.

Usually, property handles should be closed by the application (explicitly or by destroying the property handle object). When, for some reason, access nodes remain unclosed, the database will close at least all property handles referring to persistent properties before closing the database.

void CloseHandle ( Property &persons ) {

  persons.close();

}