[Libreoffice-commits] core.git: sfx2/source

Michael Meeks michael.meeks at collabora.com
Wed May 6 05:38:38 PDT 2015


 sfx2/source/dialog/basedlgs.cxx |   81 ++++++++++++++++++++--------------------
 1 file changed, 42 insertions(+), 39 deletions(-)

New commits:
commit 8c4bbc0a0ddb1ea8051f0be5a42ef128cf7d891e
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed May 6 13:42:21 2015 +0100

    tdf#91100 - don't Notify focus changes after dispose.
    
    Change-Id: If870f88d1d83db8bd436ac1bb9a1c676c34605b5

diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index d33f895..b961ac1 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -48,8 +48,8 @@ using namespace ::com::sun::star::uno;
 SingleTabDlgImpl::SingleTabDlgImpl()
         : m_pSfxPage(NULL)
         , m_pLine(NULL)
-    {
-    }
+{
+}
 
 class SfxModelessDialog_Impl : public SfxListener
 {
@@ -335,30 +335,31 @@ void SfxModelessDialog::Init(SfxBindings *pBindinx, SfxChildWindow *pCW)
 */
 bool SfxModelessDialog::Notify( NotifyEvent& rEvt )
 {
-    if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS )
-    {
-        pBindings->SetActiveFrame( pImp->pMgr->GetFrame() );
-        pImp->pMgr->Activate_Impl();
-    }
-    else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && !HasChildPathFocus() )
-    {
-        pBindings->SetActiveFrame( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > () );
-        pImp->pMgr->Deactivate_Impl();
-    }
-    else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT )
+    if ( pImp )
     {
-        // First, allow KeyInput for Dialog functions ( TAB etc. )
-        if ( !ModelessDialog::Notify( rEvt ) && SfxViewShell::Current() )
-            // then also for valid global accelerators.
-            return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() );
-        return true;
+        if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS )
+        {
+            pBindings->SetActiveFrame( pImp->pMgr->GetFrame() );
+            pImp->pMgr->Activate_Impl();
+        }
+        else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && !HasChildPathFocus() )
+        {
+            pBindings->SetActiveFrame( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > () );
+            pImp->pMgr->Deactivate_Impl();
+        }
+        else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT )
+        {
+            // First, allow KeyInput for Dialog functions ( TAB etc. )
+            if ( !ModelessDialog::Notify( rEvt ) && SfxViewShell::Current() )
+                // then also for valid global accelerators.
+                return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() );
+            return true;
+        }
     }
 
     return ModelessDialog::Notify( rEvt );
 }
 
-
-
 SfxModelessDialog::~SfxModelessDialog()
 {
     disposeOnce();
@@ -369,6 +370,7 @@ void SfxModelessDialog::dispose()
     if ( pImp->pMgr->GetFrame().is() && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
         pBindings->SetActiveFrame( NULL );
     delete pImp;
+    pImp = NULL;
     ModelessDialog::dispose();
 }
 
@@ -423,33 +425,34 @@ bool SfxFloatingWindow::Notify( NotifyEvent& rEvt )
 */
 
 {
-    if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS )
-    {
-        pBindings->SetActiveFrame( pImp->pMgr->GetFrame() );
-        pImp->pMgr->Activate_Impl();
-    }
-    else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS )
+    if ( pImp )
     {
-        if ( !HasChildPathFocus() )
+        if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS )
         {
-            pBindings->SetActiveFrame( NULL );
-            pImp->pMgr->Deactivate_Impl();
+            pBindings->SetActiveFrame( pImp->pMgr->GetFrame() );
+            pImp->pMgr->Activate_Impl();
+        }
+        else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS )
+        {
+            if ( !HasChildPathFocus() )
+            {
+                pBindings->SetActiveFrame( NULL );
+                pImp->pMgr->Deactivate_Impl();
+            }
+        }
+        else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT )
+        {
+            // First, allow KeyInput for Dialog functions
+            if ( !FloatingWindow::Notify( rEvt ) && SfxViewShell::Current() )
+                // then also for valid global accelerators.
+                return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() );
+            return true;
         }
-    }
-    else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT )
-    {
-        // First, allow KeyInput for Dialog functions
-        if ( !FloatingWindow::Notify( rEvt ) && SfxViewShell::Current() )
-            // then also for valid global accelerators.
-            return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() );
-        return true;
     }
 
     return FloatingWindow::Notify( rEvt );
 }
 
-
-
 SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx,
                         SfxChildWindow *pCW,
                         vcl::Window* pParent, WinBits nWinBits) :


More information about the Libreoffice-commits mailing list