summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-06-03 10:57:18 +0100
committerMichael Stahl <mstahl@redhat.com>2015-09-30 11:09:08 +0200
commit2d213a44ac71e5df5576463303a5a715e7b1700e (patch)
treea9cb29b9ef83c36bc61e439849da76625e90bb97 /sc
parent064b759c4973d2735155ed71eb534093eae4da25 (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 (cherry picked from commit 5f36b1954438caef95053c2c0b7d0417e1aa5b31) Signed-off-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/vba/vbaeventshelper.cxx9
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;
}