Issue 115125 - Make FindOrCreateViewFrame_Impl(...) exception safe
Summary: Make FindOrCreateViewFrame_Impl(...) exception safe
Status: CONFIRMED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: OOO330m11
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-19 15:58 UTC by carsten.driesner
Modified: 2013-08-07 15:31 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description carsten.driesner 2010-10-19 15:58:22 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(...).
Comment 1 carsten.driesner 2010-10-19 15:59:56 UTC
cd: Set mav on CC.

cd->mav: If we fix this we will need a comprehensive code-review.