summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-07-27 10:03:28 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-27 10:07:51 +0000
commitc0f1c0da77cf9f148b3f29aaf0965dfb43b8a32c (patch)
tree238386b18511e4d3610af9cc6ca064ce46193240 /svx/source
parent5733910b2b3ac82cb3cf7a1be6b3576c2e97145e (diff)
svx lok: avoid SfxViewShell::Current() during constructing a new view shell
Currently when a text edit is started, then in the LOK case if there is an other view that shows the same page, then both draw views will have an outliner view showing the text edit. This means that in case a view shell is created after starting the text edit, that won't have an outliner view for the text edit. Before fixing this, calls to SfxViewShell::Current() has to be avoided when we're in the process of setting up a new LOK view. In case of Impress, this is a double initialization, and by the time SdrObjEditView::ImpMakeOutlinerView() is called, we're already in the process of setting up the second SfxViewShell (as part of SdXImpressDocument::initializeForTiledRendering()), but SfxViewShell::Current() still points to the old view shell. Which means that the outliner view would refer to a view shell that's deleted soon, and we crash as soon as it tries to invoke a LOK callback. Fix this by adding a virtual member function to SdrObjEditView, and override it in sd, so in case applications want to provide a more precise way of giving the view shell owning a draw view, then they can. Change-Id: Ie0005f73237d4ff9cf576bf16fa5b46280f13759 Reviewed-on: https://gerrit.libreoffice.org/27561 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/svdraw/svdedxv.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 9a4588060b71..cd6e083eac5f 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -142,6 +142,11 @@ void SdrObjEditView::TakeActionRect(Rectangle& rRect) const
}
}
+SfxViewShell* SdrObjEditView::GetSfxViewShell() const
+{
+ return nullptr;
+}
+
void SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
{
SdrGlueEditView::Notify(rBC,rHint);
@@ -461,7 +466,14 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, bool /*bNoP
}
pOutlView->SetControlWord(nStat);
pOutlView->SetBackgroundColor( aBackground );
- pOutlView->registerLibreOfficeKitViewCallback(SfxViewShell::Current());
+
+ // In case we're in the process of constructing a new view shell,
+ // SfxViewShell::Current() may still point to the old one. So if possible,
+ // depend on the application owning this draw view to provide the view
+ // shell.
+ SfxViewShell* pSfxViewShell = GetSfxViewShell();
+ pOutlView->registerLibreOfficeKitViewCallback(pSfxViewShell ? pSfxViewShell : SfxViewShell::Current());
+
if (pText!=nullptr)
{
pOutlView->SetAnchorMode((EVAnchorMode)(pText->GetOutlinerViewAnchorMode()));