summaryrefslogtreecommitdiff
path: root/sw/source/uibase/uiview/uivwimp.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-07-11 22:42:58 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-07-12 09:03:50 +0200
commit637538a9957af5deb69e6677af7c1d62cdaf3eb2 (patch)
treeeb32c3662db83c352e06a75b0c73197b997d8872 /sw/source/uibase/uiview/uivwimp.cxx
parenta1aa4f84cff24e7d92ae3e03058bd3ccb6fec60c (diff)
Related: tdf#107976 SwView_Impl::AddTransferable: remove dead weak references
So that the vector doesn't grow till document close without a reason. Change-Id: Iec06e47e39274df7de46c971692054f4f0bcbc96 Reviewed-on: https://gerrit.libreoffice.org/39840 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/source/uibase/uiview/uivwimp.cxx')
-rw-r--r--sw/source/uibase/uiview/uivwimp.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx
index 2ab3dfd58c41..f3f951669ca9 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -226,6 +226,16 @@ void SwView_Impl::AddTransferable(SwTransferable& rTransferable)
//prevent removing of the non-referenced SwTransferable
rTransferable.m_refCount++;
{
+ // Remove previously added, but no longer existing weak references.
+ for (auto it = mxTransferables.begin(); it != mxTransferables.end();)
+ {
+ uno::Reference<lang::XUnoTunnel> xTunnel(it->get(), uno::UNO_QUERY);
+ if (!xTunnel.is())
+ it = mxTransferables.erase(it);
+ else
+ ++it;
+ }
+
mxTransferables.push_back(uno::WeakReference<lang::XUnoTunnel>(uno::Reference<lang::XUnoTunnel>(&rTransferable)));
}
rTransferable.m_refCount--;