[Libreoffice-commits] core.git: sfx2/source
Caolán McNamara
caolanm at redhat.com
Tue Feb 28 16:17:41 UTC 2017
sfx2/source/view/viewfrm.cxx | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
New commits:
commit 67070d583871ec77400b434b4f976c63768ad5b3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 28 10:35:50 2017 +0000
don't have to create SfxApplication if none exists
Change-Id: I312f00e8b2956470eaa496abfa2687c296f256ae
Reviewed-on: https://gerrit.libreoffice.org/34717
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 5848f6b..12fc132 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
More information about the Libreoffice-commits
mailing list