summaryrefslogtreecommitdiffstats
path: root/sfx2
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-07-15 17:12:20 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-15 18:07:44 +0200
commit85c5a172953ac29d1fcab3f4c2f19fa897074e52 (patch)
treeb19ac884eaec1714f74656e31348ed69ab9cbabe /sfx2
parentlokdocview: ignore notifications on view shutdown (diff)
downloadcore-85c5a172953ac29d1fcab3f4c2f19fa897074e52.tar.gz
core-85c5a172953ac29d1fcab3f4c2f19fa897074e52.zip
sfx2 lok: handle when SfxViewFrame::Current() returns nullptr
In these two cases no need to call it and dereference the result unconditionally, there are other ways to get the info. Change-Id: Idb5969e909dc2faed97a5a4ac79dfcc1aec8ddcd
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokhelper.cxx17
1 files changed, 2 insertions, 15 deletions
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 653dd7f58e17..d027bad47f15 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -38,7 +38,7 @@ int shellToView(SfxViewShell* pViewShell)
int SfxLokHelper::createView()
{
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst();
SfxRequest aRequest(pViewFrame, SID_NEWWINDOW);
pViewFrame->ExecView_Impl(aRequest);
@@ -91,21 +91,8 @@ int SfxLokHelper::getView(SfxViewShell* pViewShell)
std::size_t SfxLokHelper::getViews()
{
- std::size_t nRet = 0;
-
- SfxViewFrame* pViewFrame = SfxViewFrame::Current();
- if (!pViewFrame)
- return nRet;
-
- SfxObjectShell* pObjectShell = pViewFrame->GetObjectShell();
SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl();
- for (SfxViewShell* i : rViewArr)
- {
- if (i->GetObjectShell() == pObjectShell)
- ++nRet;
- }
-
- return nRet;
+ return rViewArr.size();
}
void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload)