[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/source

Michael Meeks michael.meeks at collabora.com
Sat Jun 20 06:52:32 PDT 2015


 sw/source/uibase/docvw/srcedtw.cxx  |   17 +++++++++++++----
 sw/source/uibase/uiview/srcview.cxx |    2 ++
 2 files changed, 15 insertions(+), 4 deletions(-)

New commits:
commit ffc08eac223211d3ca2d4ebadb9ccb8e26d22a5e
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat Jun 20 12:46:31 2015 +0100

    tdf#92166 - dispose the SwSrcEditWindow properly.
    
    Also improve dispose method to cleanup various pointers.
    Also avoid crash on post dispose MouseUp event.
    
    Change-Id: Ic337a8306566d5b5c81b939be6f89f34fbcc5847

diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index eb9dbf4..c15e72d 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -283,13 +283,18 @@ void SwSrcEditWindow::dispose()
         n->removePropertiesChangeListener(listener_.get());
     }
     aSyntaxIdle.Stop();
+    if ( pOutWin )
+        pOutWin->SetTextView( NULL );
+
     if ( pTextEngine )
     {
         EndListening( *pTextEngine );
         pTextEngine->RemoveView( pTextView );
 
         delete pTextView;
+        pTextView = NULL;
         delete pTextEngine;
+        pTextEngine = NULL;
     }
     pHScrollbar.disposeAndClear();
     pVScrollbar.disposeAndClear();
@@ -399,10 +404,14 @@ void  TextViewOutWin::MouseButtonUp( const MouseEvent &rEvt )
     if ( pTextView )
     {
         pTextView->MouseButtonUp( rEvt );
-        SfxBindings& rBindings = static_cast<SwSrcEditWindow*>(GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
-        rBindings.Invalidate( SID_TABLE_CELL );
-        rBindings.Invalidate( SID_CUT );
-        rBindings.Invalidate( SID_COPY );
+        SfxViewFrame *pFrame = static_cast<SwSrcEditWindow*>(GetParent())->GetSrcView()->GetViewFrame();
+        if ( pFrame )
+        {
+            SfxBindings& rBindings = pFrame->GetBindings();
+            rBindings.Invalidate( SID_TABLE_CELL );
+            rBindings.Invalidate( SID_CUT );
+            rBindings.Invalidate( SID_COPY );
+        }
     }
 }
 
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index b29c897..db8aeba 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -243,6 +243,8 @@ SwSrcView::~SwSrcView()
                             (delay != 0) || !url.isEmpty());
     EndListening(*pDocShell);
     delete pSearchItem;
+
+    aEditWin.disposeAndClear();
 }
 
 void SwSrcView::SaveContentTo(SfxMedium& rMed)


More information about the Libreoffice-commits mailing list