diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-06-03 10:57:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-03 11:29:43 +0100 |
commit | 5f36b1954438caef95053c2c0b7d0417e1aa5b31 (patch) | |
tree | 762b9709b7fd11e9bc2580d50d61ce1cf87cee70 /sc | |
parent | 9d0c6308be5fb086e51cb8b4b0652f3d6184fd3c (diff) |
intermittent CppunitTest_sc_macros_test failure
void OutputDevice::acquire() const: Assertion `mnRefCnt>0' failed"
Window gets destroyed between postWindowResizeEvent and processWindowResizeEvent
Change-Id: I3452a23ad8c3b6d863a56b73166520ef103dad1b
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/vba/vbaeventshelper.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx index d35e88518f3e..e787031b774f 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; } |