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

Justus Winter 4winter at informatik.uni-hamburg.de
Tue Aug 14 10:22:06 PDT 2012


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


More information about the notmuch mailing list