include/comphelper/interfacecontainer4.hxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 29de154fdfd5ce69ec906e04823c7d1cbbbbcdf9
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sat Oct 29 13:22:35 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Oct 29 19:52:14 2022 +0200

    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.gran...@collabora.co.uk>

diff --git a/include/comphelper/interfacecontainer4.hxx 
b/include/comphelper/interfacecontainer4.hxx
index 20429954d56d..6ec1ca7179e2 100644
--- a/include/comphelper/interfacecontainer4.hxx
+++ b/include/comphelper/interfacecontainer4.hxx
@@ -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())

Reply via email to