Apache OpenOffice (AOO) Bugzilla – Issue 115125
Make FindOrCreateViewFrame_Impl(...) exception safe
Last modified: 2013-08-07 15:31:14 UTC
If FindOrCreateViewFrame_Impl(...) in <http://hg.services.openoffice.org/DEV300/file/2ebd15d9e8a6/sfx2/source/doc/sfxbasemodel.cxx#l3968> throws a com::sun::star::uno::Exception-derived exception, the process crashes with the following stack. #0 0x00000000 in ?? () #1 0x00918ae9 in SfxFrame::GetCurrentDocument (this=0x2cbaf150) at /net/so-cwsserv02/export/cws/sb129/DEV300/ooo/sfx2/source/view/frame.cxx:355 #2 0x00a90047 in sfx::intern::ViewCreationGuard::impl_closeAll (this=0xbfff9b90) at /net/so-cwsserv02/export/cws/sb129/DEV300/ooo/sfx2/source/doc/sfxbasemodel.cxx:3870 #3 0x00a900f6 in sfx::intern::ViewCreationGuard::~ViewCreationGuard (this=0xbfff9b90) at /net/so-cwsserv02/export/cws/sb129/DEV300/ooo/sfx2/source/doc/sfxbasemodel.cxx:3852 #4 0x008d0310 in SfxBaseModel::createViewController (this=0x260534d4, i_rViewName=@0xbfff9d34, i_rArguments=@0xbfff9c68, i_rFrame=@0xbfff9ef8) at /net/so-cwsserv02/export/cws/sb129/DEV300/ooo/sfx2/source/doc/sfxbasemodel.cxx:4017 #5 0x00914188 in SfxFrameLoader_Impl::impl_createDocumentView (this=0x25a38720, i_rModel=@0xbfff9d4c, i_rFrame=@0xbfff9ef8, i_rViewFactoryArgs=@0xbfff9d3c, i_rViewName=@0xbfff9d34) at /net/so-cwsserv02/export/cws/sb129/DEV300/ooo/sfx2/source/view/frmload.cxx:528 #6 0x00917b03 in SfxFrameLoader_Impl::load (this=0x25a38720, rArgs=@0xbfff9ef0, _rTargetFrame=@0xbfff9ef8) at /net/so-cwsserv02/export/cws/sb129/DEV300/ooo/sfx2/source/view/frmload.cxx:666 #7 0x2238cdc5 in framework::LoadEnv::impl_loadContent () #8 0x2238d49c in framework::LoadEnv::startLoading () #9 0x2237f0ed in framework::LoadDispatcher::impl_dispatch () #10 0x2237f835 in framework::LoadDispatcher::dispatchWithReturnValue () #11 0x0045997b in comphelper::SynchronousDispatch::dispatch () #12 0x000e4a85 in desktop::DispatchWatcher::executeDispatchRequests () #13 0x000ed552 in desktop::OfficeIPCThread::ExecuteCmdLineRequests () #14 0x000cc853 in desktop::Desktop::OpenClients () #15 0x000cea06 in desktop::Desktop::OpenClients_Impl () #16 0x0be51e7a in ImplWindowFrameProc () #17 0x0bf1116d in AquaSalInstance::Yield () #18 0x0bc298ec in Application::Yield () #19 0x0bc299ba in Application::Execute () #20 0x000d3261 in desktop::Desktop::Main () #21 0x0bc303b1 in ImplSVMain () #22 0x0bf1195e in AquaSalInstance::handleAppDefinedEvent () #23 0x0bf14b6c in -[VCL_NSApplication sendEvent:] () #24 0x90298fe7 in -[NSApplication run] () #25 0x902661d8 in NSApplicationMain () #26 0x0bf11cdc in ImplSVMainHook () #27 0x0bc3046b in SVMain () #28 0x000f0850 in soffice_main () #29 0x00001f0e in main () In SfxFrame::GetCurrentDocument, pImp->pCurrentViewFrame is non-null but the object it points to is apparently already destroyed or otherwise overwritten - the vtable pointer is also non-null, but the GetDispatcher pointer is null. We should make the code exception safe to prevent crashes like the one described here. A code review revealed some problems in SfxViewFrame ctors, e.g. SetCurrentViewFrame_Impl() and pImp->pWindow = new SfxViewFrameWindow_Impl(...).
cd: Set mav on CC. cd->mav: If we fix this we will need a comprehensive code-review.