INTEGRATION: CWS emblock1 (1.72.10); FILE MERGED

2005/07/13 13:36:46 pl 1.72.10.1: #i51893# fix a concurrency problem when copying bitmaps
This commit is contained in:
Jens-Heiner Rechtien
2005-10-27 13:09:58 +00:00
parent fc2469dec3
commit d612c170f0

View File

@@ -4,9 +4,9 @@
* *
* $RCSfile: X11_selection.cxx,v $ * $RCSfile: X11_selection.cxx,v $
* *
* $Revision: 1.73 $ * $Revision: 1.74 $
* *
* last change: $Author: rt $ $Date: 2005-09-08 18:02:37 $ * last change: $Author: hr $ $Date: 2005-10-27 14:09:58 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
@@ -1444,6 +1444,9 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
aGuard.reset(); aGuard.reset();
if( bConverted ) if( bConverted )
{ {
// get pixmap again since clearing the guard could have invalidated
// the pixmap in another thread
pPixmap = getPixmapHolder( selection );
// conversion succeeded, so aData contains image/bmp now // conversion succeeded, so aData contains image/bmp now
if( pPixmap->needsConversion( (const sal_uInt8*)aData.getConstArray() ) if( pPixmap->needsConversion( (const sal_uInt8*)aData.getConstArray() )
&& m_xBitmapConverter.is() ) && m_xBitmapConverter.is() )
@@ -1456,13 +1459,12 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
Sequence<sal_Int16> aOutIndex; Sequence<sal_Int16> aOutIndex;
aArgs.getArray()[0] = makeAny( xBM ); aArgs.getArray()[0] = makeAny( xBM );
aArgs.getArray()[1] = makeAny( (sal_uInt16)pPixmap->getDepth() ); aArgs.getArray()[1] = makeAny( (sal_uInt16)pPixmap->getDepth() );
aGuard.clear();
try try
{ {
aGuard.clear();
Any aResult = Any aResult =
m_xBitmapConverter->invoke( OUString::createFromAscii( "convert-bitmap-depth" ), m_xBitmapConverter->invoke( OUString::createFromAscii( "convert-bitmap-depth" ),
aArgs, aOutIndex, aOutArgs ); aArgs, aOutIndex, aOutArgs );
aGuard.reset();
if( aResult >>= xBM ) if( aResult >>= xBM )
aData = xBM->getDIB(); aData = xBM->getDIB();
} }
@@ -1472,7 +1474,11 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
fprintf( stderr, "exception in bitmap converter\n" ); fprintf( stderr, "exception in bitmap converter\n" );
#endif #endif
} }
aGuard.reset();
} }
// get pixmap again since clearing the guard could have invalidated
// the pixmap in another thread
pPixmap = getPixmapHolder( selection );
nValue = (XID)pPixmap->setBitmapData( (const sal_uInt8*)aData.getConstArray() ); nValue = (XID)pPixmap->setBitmapData( (const sal_uInt8*)aData.getConstArray() );
} }
if( nValue == None ) if( nValue == None )