tdf#126788 reduce cost of OInterfaceContainerHelper4::disposeAndClear

use the empty singleton to avoid allocating an empty vector

Change-Id: I2eb80228a870414fd253cdbe8d281610d2d3115d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142018
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2022-10-29 19:52:14 +02:00
parent 2c4aabb220
commit 29de154fdf
+2 -1
View File
@@ -369,7 +369,8 @@ void OInterfaceContainerHelper4<ListenerT>::disposeAndClear(std::unique_lock<std
const css::lang::EventObject& rEvt)
{
OInterfaceIteratorHelper4<ListenerT> aIt(rGuard, *this);
maData->clear();
maData
= DEFAULT(); // cheaper than calling maData->clear() because it doesn't allocate a new vector
rGuard.unlock();
// unlock followed by iterating is only safe because we are not going to call remove() on the iterator
while (aIt.hasMoreElements())