[Libreoffice-commits] core.git: sw/source
Katarina Behrens
Katarina.Behrens at cib.de
Sat Feb 24 13:35:52 UTC 2018
sw/source/uibase/uiview/view1.cxx | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
New commits:
commit b7e3e73b8015e20f8303ea1f2a2156128ae411e2
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Fri Feb 23 16:13:02 2018 +0100
Make shell stack more robust against rogue extensions
It shouldn't happen that a view is placed above the shells
it has spawned on sfx2 dispatcher's shell stack 'cause
during dispose, such view gets deleted before the shells
that still refer to it.
Alas it does happen with Wollmux (which makes couple of
Writer UNO API calls before SwView is activated) so guard
against that
Change-Id: Ic7f21992c5e55a48c63dffc733c8f5b0a59a9126
Reviewed-on: https://gerrit.libreoffice.org/50256
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/source/uibase/uiview/view1.cxx b/sw/source/uibase/uiview/view1.cxx
index 4f3650a6e7dc..c5c70feaf26c 100644
--- a/sw/source/uibase/uiview/view1.cxx
+++ b/sw/source/uibase/uiview/view1.cxx
@@ -22,6 +22,7 @@
#include <svx/ruler.hxx>
#include <idxmrk.hxx>
#include <view.hxx>
+#include <basesh.hxx>
#include <wrtsh.hxx>
#include <swmodule.hxx>
#include <viewopt.hxx>
@@ -68,6 +69,32 @@ void SwView::Activate(bool bMDIActivate)
if ( bMDIActivate )
{
+ if ( m_pShell )
+ {
+ SfxDispatcher &rDispatcher = GetDispatcher();
+ SfxShell *pTopShell = rDispatcher.GetShell( 0 );
+
+ // this SwView is the top-most shell on the stack
+ if ( pTopShell == this )
+ {
+ for ( sal_uInt16 i = 1; true; ++i )
+ {
+ SfxShell *pSfxShell = rDispatcher.GetShell( i );
+ // does the stack contain any shells spawned by this SwView already?
+ if ( ( dynamic_cast< const SwBaseShell *>( pSfxShell ) != nullptr
+ || dynamic_cast< const FmFormShell *>( pSfxShell ) != nullptr )
+ && ( pSfxShell->GetViewShell() == this ) )
+ {
+ // it shouldn't b/c we haven't been activated yet
+ // so assert that 'cause it'll crash during dispose at the latest
+ assert( pSfxShell && "Corrupted shell stack: dependent shell positioned below its view");
+ }
+ else
+ break;
+ }
+ }
+ }
+
m_pWrtShell->ShellGetFocus(); // Selections visible
if( !m_sSwViewData.isEmpty() )
More information about the Libreoffice-commits
mailing list