Re: [PATCH] lib/config: don't set destructor until iterator is initialized.

Subject: Re: [PATCH] lib/config: don't set destructor until iterator is initialized.

Date: Sat, 31 Oct 2020 14:49:56 -0300

To: Olivier Taïbi, notmuch@notmuchmail.org

Cc:

From: David Bremner


David Bremner <david@tethera.net> writes:

> As diagnosed by Olivier Taïbi in
> id:20201027100916.emry3k2wujod4xnl@galois.lan, if an exception is
> thrown while the initialization is happening (e.g. if the function is
> called on a closed database), then the destructor is (sometimes)
> invoked on an uninitialized Xapian object.
>
> Solve the problem by moving the setting of the destructor until after
> the placement new successfully completes. It is conceivable this might
> cause a memory leak, but that seems preferable to crashing, and in any
> case, there seems to be nothing better to be done if the
> initialization is failing things are in an undefined state by
> definition.

This one is pushed also. Let me know if it breaks something.

d
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: