summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-05-06 14:43:01 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-05-06 14:43:01 +0200
commitac084249c20528bd55092715fff2b124639e0868 (patch)
tree6da09215f5c5901d5eb6cab6869d20bc1ec631a2 /toolkit
parent1afc19fa95b833e68330b91f06e036d908f9e30f (diff)
os141: ensure the VCLXWindow is not destroyed while the callback event is underway
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/vclxwindow.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index fe906d8557d3..dd4d56586b03 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -306,12 +306,18 @@ void VCLXWindowImpl::callBackAsync( const VCLXWindow::Callback& i_callback )
DBG_TESTSOLARMUTEX();
maCallbackEvents.push_back( i_callback );
if ( !mnCallbackEventId )
+ {
+ // ensure our VCLXWindow is not destroyed while the event is underway
+ mrAntiImpl.acquire();
mnCallbackEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessCallbacks ) );
+ }
}
//----------------------------------------------------------------------------------------------------------------------
IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG )
{
+ const Reference< uno::XInterface > xKeepAlive( mrAntiImpl );
+
// work on a copy of the callback array
CallbackArray aCallbacksCopy;
{
@@ -319,6 +325,9 @@ IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG )
aCallbacksCopy = maCallbackEvents;
maCallbackEvents.clear();
+ // we acquired our VCLXWindow once before posting the event, release this one ref now
+ mrAntiImpl.release();
+
if ( !mnCallbackEventId )
// we were disposed while waiting for the mutex to lock
return 1L;