From 1ac5353bbb25bd9ff0ab0e157b3dbd0da325480a Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 6 Mar 2024 16:06:40 +0600 Subject: Use weak reference to SfxObjectShell in SfxEventHint to avoid use-after-free The events may be processed after the shell has been destroyed. This is happening reliably after commit e2bfc34d146806a8f96be0cd2323d716f12cba4e (Reimplement OleComponentNative_Impl to use IGlobalInterfaceTable, 2024-03-11) when controlling LibreOffice from external Java scripts; but obviously, it could happen before as well. Now SotObject inherits from cppu::OWeakObject, instead of SvRefBase. Change-Id: I73a3531499a3068c801c98f40de39bdf8ad90b2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164458 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski --- svtools/source/misc/imagemgr.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svtools') diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 85376581ee51..1e868c43e7ce 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -403,7 +403,7 @@ static SvImageId GetImageId_Impl( SvImageId nId = SvImageId::WriterTemplate; try { - tools::SvRef aStorage = new SotStorage( sURL, StreamMode::STD_READ ); + rtl::Reference aStorage = new SotStorage(sURL, StreamMode::STD_READ); if ( !aStorage->GetError() ) { SvGlobalName aGlobalName = aStorage->GetClassName(); -- cgit v1.2.3