Re: ‘class Xapian::Database’ has no member named ‘close’

Subject: Re: ‘class Xapian::Database’ has no member named ‘close’

Date: Tue, 14 Aug 2012 19:22:06 +0200

To: Jani Nikula, Michal Nazarewicz, David Bremner, notmuch@notmuchmail.org

Cc:

From: Justus Winter


Quoting Jani Nikula (2012-08-14 14:57:13)
> > Is close() really required though?  The comment justifies it saying
> > that:
> >
> >       Many Xapian objects hold references to the database, so merely
> >       deleting the database may not suffice to close it.  Thus, we
> >       explicitly close it here.
> >
> > but wouldn't the database get closed when the last reference gets
> > deleted anyway?

Yes, it is.

> IIRC this was related to how closing is handled in the python
> bindings.

Well this issue isn't in anyway specific to the python bindings, but
in c you can determine exactly whether a database has been closed
because this only happens if you explicitly destroy the database
object. In any garbage collected language you have to wait for the
object to be collected and this is usually not easy to detect.

So we decided to explicitly close the database and to split
..database_destroy in ..database_close and ..database_destroy later
on.

Justus

Thread: