diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-03-06 16:06:40 +0600 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-03-11 04:43:28 +0100 |
commit | 1ac5353bbb25bd9ff0ab0e157b3dbd0da325480a (patch) | |
tree | 540dc6574b0d1b2e67afee3d670b8805493f28fa /sc/source/filter/excel/excimp8.cxx | |
parent | e2bfc34d146806a8f96be0cd2323d716f12cba4e (diff) |
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 <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source/filter/excel/excimp8.cxx')
-rw-r--r-- | sc/source/filter/excel/excimp8.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 2df1ec268324..12ed36cebd48 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -322,7 +322,7 @@ void ImportExcel8::Feat() void ImportExcel8::ReadBasic() { ScDocShell* pShell = GetDocShell(); - tools::SvRef<SotStorage> xRootStrg = GetRootStorage(); + rtl::Reference<SotStorage> xRootStrg = GetRootStorage(); if( !pShell || !xRootStrg.is() ) return; @@ -335,7 +335,7 @@ void ImportExcel8::ReadBasic() officecfg::Office::Calc::Filter::Import::VBA::Executable::get() ) { // see if we have the XCB stream - tools::SvRef<SotStorageStream> xXCB = xRootStrg->OpenSotStream( "XCB", StreamMode::STD_READ ); + rtl::Reference<SotStorageStream> xXCB = xRootStrg->OpenSotStream( "XCB", StreamMode::STD_READ ); if ( xXCB.is()|| ERRCODE_NONE == xXCB->GetError() ) { ScCTBWrapper wrapper; @@ -412,7 +412,7 @@ void ImportExcel8::PostDocLoad() return; // BIFF5+ without storage is possible - tools::SvRef<SotStorage> xRootStrg = GetRootStorage(); + rtl::Reference<SotStorage> xRootStrg = GetRootStorage(); if( xRootStrg.is() ) try { uno::Reference< document::XDocumentPropertiesSupplier > xDPS( static_cast<cppu::OWeakObject*>(pShell->GetModel()), uno::UNO_QUERY_THROW ); |