changing the UNO dispose/disposing() protocol ?

Noel Grandin noelgrandin at
Sun May 28 14:02:21 UTC 2023


I would like to change the existing UNO dispose()/disposing() protocol.

Specifically, I would like to change the part where if a component is
already disposed, it throws a DisposedException. Instead it should simply
ignore the call (i.e. return early)

The reason for this, is threefold

(1) Very little of the calling code seems to know, or care, if child
components throw this exception. It is almost never caught. When it _is__
thrown, the only real effect is that it prevents other child components
from being disposed.

(2) In a complex web of components, it may not be possible to know with
certainty if some other object has been disposed or not.

(3) In general, protocols of this category (e.g. closing a file) are
designed to ignore repeated calls, so our current design is a bit of an

I can't see how changing this will make anything worse - anything that
currently catches DisposedException will simply no longer exercise that
catch path.

It might cause some regressions where code paths are currently being
silently dropped because of a DisposedException, but then that code was
buggy already.

Regards , Noel Grandin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the LibreOffice mailing list