diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-02-28 10:35:50 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-02-28 16:17:03 +0000 |
commit | 67070d583871ec77400b434b4f976c63768ad5b3 (patch) | |
tree | ec0e1c172a93250bd6d12ac98fffbba5f5271beb | |
parent | 3ae57096ae33eeed5b4e658ebdf3563a6dd86474 (diff) |
don't have to create SfxApplication if none exists
Change-Id: I312f00e8b2956470eaa496abfa2687c296f256ae
Reviewed-on: https://gerrit.libreoffice.org/34717
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 5848f6b63a61..12fc132a8542 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1433,10 +1433,13 @@ SfxViewFrame::~SfxViewFrame() GetFrame().SetCurrentViewFrame_Impl( nullptr ); // Unregister from the Frame List. - SfxApplication *pSfxApp = SfxGetpApp(); - SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl(); - SfxViewFrameArr_Impl::iterator it = std::find( rFrames.begin(), rFrames.end(), this ); - rFrames.erase( it ); + SfxApplication *pSfxApp = SfxApplication::Get(); + if (pSfxApp) + { + SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl(); + SfxViewFrameArr_Impl::iterator it = std::find( rFrames.begin(), rFrames.end(), this ); + rFrames.erase( it ); + } // Delete Member KillDispatcher_Impl(); @@ -1472,7 +1475,10 @@ SfxViewFrame* SfxViewFrame::GetFirst bool bOnlyIfVisible ) { - SfxApplication *pSfxApp = SfxGetpApp(); + SfxApplication *pSfxApp = SfxApplication::Get(); + if (!pSfxApp) + return nullptr; + SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl(); // search for a SfxDocument of the specified type @@ -1495,7 +1501,10 @@ SfxViewFrame* SfxViewFrame::GetNext bool bOnlyIfVisible ) { - SfxApplication *pSfxApp = SfxGetpApp(); + SfxApplication *pSfxApp = SfxApplication::Get(); + if (!pSfxApp) + return nullptr; + SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl(); // refind the specified predecessor |