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

Caolán McNamara caolanm at redhat.com
Wed Sep 30 02:10:43 PDT 2015


 sc/source/ui/vba/vbaeventshelper.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 2d213a44ac71e5df5576463303a5a715e7b1700e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 3 10:57:18 2015 +0100

    intermittent CppunitTest_sc_macros_test failure
    
    void OutputDevice::acquire() const: Assertion `mnRefCnt>0' failed"
    
    Window gets destroyed between postWindowResizeEvent and processWindowResizeEvent
    
    Change-Id: I3452a23ad8c3b6d863a56b73166520ef103dad1b
    (cherry picked from commit 5f36b1954438caef95053c2c0b7d0417e1aa5b31)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx
index d35e885..e787031 100644
--- a/sc/source/ui/vba/vbaeventshelper.cxx
+++ b/sc/source/ui/vba/vbaeventshelper.cxx
@@ -169,7 +169,8 @@ private:
     uno::Reference< frame::XModel > mxModel;
     ScDocShell*         mpDocShell;
     WindowControllerMap maControllers;          /// Maps VCL top windows to their controllers.
-    VclPtr<vcl::Window>            mpActiveWindow;         /// Currently activated window, to prevent multiple (de)activation.
+    std::set< VclPtr<vcl::Window> > maPostedWindows; /// Keeps processWindowResizeEvent windows from being deleted between postWindowResizeEvent and processWindowResizeEvent
+    VclPtr<vcl::Window>            mpActiveWindow; /// Currently activated window, to prevent multiple (de)activation.
     bool                mbWindowResized;        /// True = window resize system event processed.
     bool                mbBorderChanged;        /// True = borders changed system event processed.
     bool                mbDisposed;
@@ -219,7 +220,9 @@ void ScVbaEventListener::startControllerListening( const uno::Reference< frame::
         try { xControllerBorder->addBorderResizeListener( this ); } catch( uno::Exception& ) {}
 
     if( vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ) )
+    {
         maControllers[ pWindow ] = rxController;
+    }
 }
 
 void ScVbaEventListener::stopControllerListening( const uno::Reference< frame::XController >& rxController )
@@ -468,6 +471,7 @@ void ScVbaEventListener::postWindowResizeEvent( vcl::Window* pWindow )
     {
         mbWindowResized = mbBorderChanged = false;
         acquire();  // ensure we don't get deleted before the timer fires
+        maPostedWindows.insert(pWindow);
         Application::PostUserEvent( LINK( this, ScVbaEventListener, processWindowResizeEvent ), pWindow );
     }
 }
@@ -484,7 +488,7 @@ IMPL_LINK( ScVbaEventListener, processWindowResizeEvent, vcl::Window*, pWindow )
         This is handled via the disposing() function which removes the window
         pointer from the member maControllers. Thus, checking whether
         maControllers contains pWindow ensures that the window is still alive. */
-    if( !mbDisposed && pWindow && (maControllers.count( pWindow ) > 0) )
+    if( !mbDisposed && pWindow && !pWindow->IsDisposed() && (maControllers.count(pWindow) > 0) )
     {
         // do not fire event unless all mouse buttons have been released
         vcl::Window::PointerState aPointerState = pWindow->GetPointerState();
@@ -500,6 +504,7 @@ IMPL_LINK( ScVbaEventListener, processWindowResizeEvent, vcl::Window*, pWindow )
             }
         }
     }
+    maPostedWindows.erase(pWindow);
     release();
     return 0;
 }


More information about the Libreoffice-commits mailing list